env
env copied to clipboard
Compile list of missing variables before erroring
Parse should try to read each of the variables before failing when checking for required, so that way users do not have to enter each one manually and find each new required variable.
$ go run main.go
required environment variable "DB_PORT" is not set
$ DB_PORT=777 go run main.go
required environment variable "DB_HOST" is not set
$ DB_HOST="localhost" DB_PORT=777 go run main.go
required environment variable "DB_NAMESPACE" is not set
and so on.
Instead, in the above case:
$ go run main.go
required environment variables ["DB_PORT", "DB_HOST", "DB_NAMESPACE", ...] are not set
or
$ go run main.go
required environment variables [
"DB_PORT",
"DB_HOST",
"DB_NAMESPACE",
...
] are not set
this is a good one, although arguably a breaking change.
If anyone wants to work on a PR for this, I would be glad to review it.
fixed in #233