From 8d94c237882623f620c5cac57b26cb5d47e12b3a Mon Sep 17 00:00:00 2001 From: Bryan Aguilar Date: Thu, 27 Jan 2022 10:11:56 -0800 Subject: [PATCH] Compact call GetConfigProvider --- pkg/config/config_factory.go | 13 +++---------- 1 file changed, 3 insertions(+), 10 deletions(-) diff --git a/pkg/config/config_factory.go b/pkg/config/config_factory.go index 436f5e3b63..f69b247139 100644 --- a/pkg/config/config_factory.go +++ b/pkg/config/config_factory.go @@ -16,13 +16,9 @@ package config import ( - "fmt" "log" "os" - "go.opentelemetry.io/collector/config" - "go.opentelemetry.io/collector/config/configmapprovider" - "go.opentelemetry.io/collector/config/configunmarshaler" "go.opentelemetry.io/collector/service" ) @@ -33,14 +29,11 @@ const ( func GetConfigProvider() service.ConfigProvider { // aws-otel-collector supports loading yaml config from Env Var // including SSM parameter store for ECS use case + loc := getConfigFlag() if configContent, ok := os.LookupEnv(envKey); ok { log.Printf("Reading AOT config from environment: %v\n", configContent) - return service.NewConfigProvider( - []string{fmt.Sprintf("env:%s", envKey)}, - map[string]configmapprovider.Provider{"env": configmapprovider.NewEnv()}, - []config.MapConverterFunc{configmapprovider.NewExpandConverter()}, - configunmarshaler.NewDefault()) + loc = "env:" + envKey } - return service.NewDefaultConfigProvider([]string{getConfigFlag()}, getSetFlag()) + return service.NewDefaultConfigProvider([]string{loc}, getSetFlag()) }