diff --git a/config/config.go b/config/config.go index 3b68294..07ba93d 100644 --- a/config/config.go +++ b/config/config.go @@ -6,6 +6,7 @@ package config import ( "github.com/kelseyhightower/envconfig" "github.com/rs/zerolog/log" + "strings" ) var ( @@ -14,7 +15,18 @@ var ( func ParseConfiguration() { err := envconfig.Process("steadybit_extension", &Config) + Config.AssumeRoles = trimSpaces(Config.AssumeRoles) + Config.Regions = trimSpaces(Config.Regions) + Config.EnrichEc2DataForTargetTypes = trimSpaces(Config.EnrichEc2DataForTargetTypes) if err != nil { log.Fatal().Err(err).Msgf("Failed to parse configuration from environment.") } } + +func trimSpaces(orig []string) []string { + var trimmed []string + for _, s := range orig { + trimmed = append(trimmed, strings.TrimSpace(s)) + } + return trimmed +}