File: options.go

package info (click to toggle)
golang-gitlab-gitlab-org-labkit 1.17.0-4
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 1,092 kB
  • sloc: sh: 210; javascript: 49; makefile: 4
file content (24 lines) | stat: -rw-r--r-- 504 bytes parent folder | download | duplicates (3)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
package http_round_tripper

type Config struct {
	labelValues map[string]string
}

// Option is used to pass options to the Factory instance.
type Option func(*Config)

func applyOptions(opts []Option) Config {
	config := Config{}
	for _, v := range opts {
		v(&config)
	}

	return config
}

// WithLabelValues will configure labels values to apply to this round tripper.
func WithLabelValues(labelValues map[string]string) Option {
	return func(config *Config) {
		config.labelValues = labelValues
	}
}