From 00b7fea14f4eeb0d5d96821edb18bf398abf6f9e Mon Sep 17 00:00:00 2001 From: Denis Dorozhkin Date: Fri, 29 Jan 2021 19:20:38 +0200 Subject: [PATCH] substitute environment variables in config files --- internal/settings/config_provider.go | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/internal/settings/config_provider.go b/internal/settings/config_provider.go index 616e7a853..33b6eba99 100644 --- a/internal/settings/config_provider.go +++ b/internal/settings/config_provider.go @@ -177,15 +177,16 @@ func getExternalConfig(filePath string) (ExternalConfig, error) { if len(data) == 0 { return ExternalConfig{}, nil } + expandedData := os.ExpandEnv(string(data)) externalConfig := ExternalConfig{} switch filepath.Ext(filePath) { case ".json": - if err := jsonUnmarshalStrict(data, &externalConfig); err != nil { + if err := jsonUnmarshalStrict([]byte(expandedData), &externalConfig); err != nil { return ExternalConfig{}, err } return externalConfig, nil case ".yaml": - if err := yaml.UnmarshalStrict(data, &externalConfig); err != nil { + if err := yaml.UnmarshalStrict([]byte(expandedData), &externalConfig); err != nil { return ExternalConfig{}, err } return externalConfig, nil