Add consul-specific option for config (as registry)

This commit is contained in:
magodo
2019-06-25 18:31:32 +08:00
parent 68764ebafc
commit 8e4fd16aff
2 changed files with 17 additions and 0 deletions

View File

@@ -74,6 +74,11 @@ func NewSource(opts ...source.Option) source.Source {
// use default config
config := api.DefaultConfig()
// use the consul config passed in the options if any
if co, ok := options.Context.Value(consulConfigKey{}).(*api.Config); ok {
config = co
}
// check if there are any addrs
a, ok := options.Context.Value(addressKey{}).(string)
if ok {