From 615e60020182411a1d7637d53158481863aa590e Mon Sep 17 00:00:00 2001 From: Lenny Goodell <44779287+lenny-intel@users.noreply.github.com> Date: Tue, 6 Apr 2021 15:02:48 -0700 Subject: [PATCH] refactor: Set the Config Version when creating Config Client (#201) This centralizes the config version for all services. closes #200 BREAKING CHANGE: Configuration in Consul now under the `/2.0/` path Signed-off-by: lenny --- bootstrap/config/config.go | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/bootstrap/config/config.go b/bootstrap/config/config.go index 753fe8b1..1d9c485b 100644 --- a/bootstrap/config/config.go +++ b/bootstrap/config/config.go @@ -21,6 +21,7 @@ import ( "fmt" "io/ioutil" "os" + "path/filepath" "reflect" "sync" @@ -40,7 +41,10 @@ import ( "github.com/BurntSushi/toml" ) -const writableKey = "/Writable" +const ( + writableKey = "/Writable" + configVersion = "2.0" +) // UpdatedStream defines the stream type that is notified by ListenForChanges when a configuration update is received. type UpdatedStream chan struct{} @@ -312,7 +316,7 @@ func (cp *Processor) createProviderClient( accessTokenFile string, providerConfig types.ServiceConfig) (configuration.Client, error) { - providerConfig.BasePath = configStem + serviceKey + providerConfig.BasePath = filepath.Join(configStem, configVersion, serviceKey) providerConfig.AccessToken = accessTokenFile cp.Logger.Info(fmt.Sprintf(