You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Hello, it would be nice if the error for when there is a missing variable expansion states that it is missing instead of "empty default". Example below.
func main() {
cfgProvider, err := config.NewYAML(config.Source(strings.NewReader("sidecar: { log-level: INFO, global-tags: [pod=$POD, namespace=$NAMESPACE]}")), config.Expand(os.LookupEnv))
if err != nil {
zap.L().Fatal("could not read yaml config", zap.Error(err))
}
var cfg AppConfig
if err := cfgProvider.Get("sidecar").Populate(&cfg); err != nil {
zap.L().Fatal("could not read app config", zap.Error(err))
}
}
output:
go run main.go # no exported env vars
{"level":"fatal","message":"could not read yaml config","error":"couldn't expand environment: default is empty for \"POD\" (use \"\" for empty string)"}
It would be clearer if the error was - "missing expansion variable {VAR_NAME}" instead of "default is empty".
The text was updated successfully, but these errors were encountered:
Hello, it would be nice if the error for when there is a missing variable expansion states that it is missing instead of "empty default". Example below.
go version - 1.21.2
uber-go/config version - 1.4.0
main: go
output:
It would be clearer if the error was - "missing expansion variable {VAR_NAME}" instead of "default is empty".
The text was updated successfully, but these errors were encountered: