Skip to content

Commit

Permalink
fix: trim white spaces
Browse files Browse the repository at this point in the history
  • Loading branch information
ReuDa committed Dec 2, 2024
1 parent 010e76a commit f8539d4
Showing 1 changed file with 12 additions and 0 deletions.
12 changes: 12 additions & 0 deletions config/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ package config
import (
"github.com/kelseyhightower/envconfig"
"github.com/rs/zerolog/log"
"strings"
)

var (
Expand All @@ -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
}

0 comments on commit f8539d4

Please sign in to comment.