env icon indicating copy to clipboard operation
env copied to clipboard

Compile list of missing variables before erroring

Open DeadlySurgeon opened this issue 3 years ago • 1 comments

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

DeadlySurgeon avatar Jan 10 '22 16:01 DeadlySurgeon

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.

caarlos0 avatar Jul 12 '22 19:07 caarlos0

fixed in #233

caarlos0 avatar Aug 22 '22 12:08 caarlos0