-
Notifications
You must be signed in to change notification settings - Fork 392
Open
Description
Hi, I was checking and when starting the process:
err = envconfig.Process("MYAPP", &config)
In this case, I don't want to use prefixes, which should normally be allowed, but since I didn't specify it, I'd still have to define my environment variables as follows:
go struct
type config struct {
Host string
User string
Password string
}
env file
_HOST=""
_USER=""
_PASSWORD=""
This wouldn't be very suitable if I wanted to freely manage my environment variables. I found a one-line solution to handle this:
/home//go/pkg/mod/github.com/kelseyhightower/[email protected]/envconfig.go
:118
info.Key = strings.Join(name, "_")
Replace with:
if prefix != "" {
info.Key = strings.Join(name, "_")
}
env file
HOST=""
USER=""
PASSWORD=""
Metadata
Metadata
Assignees
Labels
No labels