Skip to content

Commit

Permalink
Values without a backing env var should not be expanded
Browse files Browse the repository at this point in the history
  • Loading branch information
m90 committed Feb 19, 2024
1 parent dd8ff5e commit 60bde0b
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion cmd/backup/config_provider.go
Original file line number Diff line number Diff line change
Expand Up @@ -103,7 +103,12 @@ func loadConfigsFromEnvFiles(directory string) ([]*Config, error) {
if err != nil {
return nil, errwrap.Wrap(err, fmt.Sprintf("error reading %s", item.Name()))
}
envFile, err := godotenv.Unmarshal(os.ExpandEnv(string(f)))
envFile, err := godotenv.Unmarshal(os.Expand(string(f), func(s string) string {
if val, ok := os.LookupEnv(s); ok {
return val
}
return s
}))
if err != nil {
return nil, errwrap.Wrap(err, fmt.Sprintf("error reading config file %s", p))
}
Expand Down

0 comments on commit 60bde0b

Please sign in to comment.