rename stuff per feedback
This commit is contained in:
parent
8e4fd16aff
commit
a8dbca756c
@ -75,7 +75,7 @@ func NewSource(opts ...source.Option) source.Source {
|
|||||||
config := api.DefaultConfig()
|
config := api.DefaultConfig()
|
||||||
|
|
||||||
// use the consul config passed in the options if any
|
// use the consul config passed in the options if any
|
||||||
if co, ok := options.Context.Value(consulConfigKey{}).(*api.Config); ok {
|
if co, ok := options.Context.Value(configKey{}).(*api.Config); ok {
|
||||||
config = co
|
config = co
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -12,7 +12,7 @@ type prefixKey struct{}
|
|||||||
type stripPrefixKey struct{}
|
type stripPrefixKey struct{}
|
||||||
type dcKey struct{}
|
type dcKey struct{}
|
||||||
type tokenKey struct{}
|
type tokenKey struct{}
|
||||||
type consulConfigKey struct{}
|
type configKey struct{}
|
||||||
|
|
||||||
// WithAddress sets the consul address
|
// WithAddress sets the consul address
|
||||||
func WithAddress(a string) source.Option {
|
func WithAddress(a string) source.Option {
|
||||||
@ -64,12 +64,12 @@ func WithToken(p string) source.Option {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// WithConsulConfig set consul-specific options
|
// WithConfig set consul-specific options
|
||||||
func WithConsulConfig(c *api.Config) source.Option {
|
func WithConfig(c *api.Config) source.Option {
|
||||||
return func(o *source.Options) {
|
return func(o *source.Options) {
|
||||||
if o.Context == nil {
|
if o.Context == nil {
|
||||||
o.Context = context.Background()
|
o.Context = context.Background()
|
||||||
}
|
}
|
||||||
o.Context = context.WithValue(o.Context, consulConfigKey{}, c)
|
o.Context = context.WithValue(o.Context, configKey{}, c)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user