Skip to content

Commit

Permalink
Merge pull request #1 from akshat23rustagi/modify_envamize
Browse files Browse the repository at this point in the history
Replaced "-" character with "_" when reading from environment variables.
  • Loading branch information
akshat23rustagi authored Jan 30, 2020
2 parents 9a227d3 + 6553cba commit e1dc2e7
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion source/env.go
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,9 @@ type EnvSource struct {
// format. Periods are replaced with single underscores. Note that reversing
// this would generally be ambiguous as underscores are common in variable keys.
func envamize(key string) string {
return strings.Replace(strings.ToUpper(key), ".", "_", -1)
key = strings.ReplaceAll(key, "-", "_")
key = strings.ReplaceAll(key, ".", "_")
return strings.ToUpper(key)
}

func NewEnvSource() *EnvSource {
Expand Down

0 comments on commit e1dc2e7

Please sign in to comment.