Skip to content

Commit

Permalink
replace env underscore to dot (#1229)
Browse files Browse the repository at this point in the history
* replace env underscore to dot

* Compatible with dot format
  • Loading branch information
longXboy committed Jul 23, 2021
1 parent d4ac341 commit 38c9def
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion config/env/env.go
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,12 @@ func (e *env) load(envStrings []string) []*config.KeyValue {
k = k[1:]
}
}

if strings.Contains(k, "_") {
kv = append(kv, &config.KeyValue{
Key: strings.Replace(k, "_", ".", -1),
Value: []byte(v),
})
}
kv = append(kv, &config.KeyValue{
Key: k,
Value: []byte(v),
Expand Down

0 comments on commit 38c9def

Please sign in to comment.