envconfig icon indicating copy to clipboard operation
envconfig copied to clipboard

Group missing required field errors.

Open bchapman opened this issue 5 years ago • 2 comments

Don't stop processing when an required variable is missing, instead build a list of the missing variables, and throw a single error at the end.

This change results in an error message such as required key(s) missing values: FOO,BAR

Related to https://github.com/kelseyhightower/envconfig/issues/143

bchapman avatar Jun 16 '19 18:06 bchapman

@bchapman

I don't agree.

If there is any required tag, when the value is empty, it should early return the error.

TonyPythoneer avatar Aug 18 '19 14:08 TonyPythoneer

I totally agree with the change request here

It makes no sense to stop on the first error. It is just lazy.

Imagine a system with dozens of required fields. Running the server dozens of times to get the missing values from the environment is just not helpful (specially on production environments which may have a long environment variables list and modifying them may take some time between redeploys and log analysis).

This change is really simple, maintainable, doesn't hurt performance and greatly improves UX. Thanks @bchapman!

hbobenicio avatar Dec 16 '19 12:12 hbobenicio