diff --git a/config/source/consul/consul.go b/config/source/consul/consul.go index c4a6bf60..f5c3c695 100644 --- a/config/source/consul/consul.go +++ b/config/source/consul/consul.go @@ -75,7 +75,7 @@ func NewSource(opts ...source.Option) source.Source { config := api.DefaultConfig() // 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 } diff --git a/config/source/consul/options.go b/config/source/consul/options.go index a1a1fadb..8bca6a66 100644 --- a/config/source/consul/options.go +++ b/config/source/consul/options.go @@ -12,7 +12,7 @@ type prefixKey struct{} type stripPrefixKey struct{} type dcKey struct{} type tokenKey struct{} -type consulConfigKey struct{} +type configKey struct{} // WithAddress sets the consul address func WithAddress(a string) source.Option { @@ -64,12 +64,12 @@ func WithToken(p string) source.Option { } } -// WithConsulConfig set consul-specific options -func WithConsulConfig(c *api.Config) source.Option { +// WithConfig set consul-specific options +func WithConfig(c *api.Config) source.Option { return func(o *source.Options) { if o.Context == nil { o.Context = context.Background() } - o.Context = context.WithValue(o.Context, consulConfigKey{}, c) + o.Context = context.WithValue(o.Context, configKey{}, c) } }