kelseyhightower / envconfig

Golang library for managing configuration data from environment variables
MIT License
5.01k stars 377 forks source link

Feature Request: Continue processing after missing required values #143

Open hbobenicio opened 5 years ago

hbobenicio commented 5 years ago

With this spec...

type spec struct {
    Foo string `required:"true"`
    Bar string `required:"true"`
}

This process...

var s spec
err := envconfig.Process("myapp", &s)
if err != nil {
    log.Fatalln(err.Error())
}

...stops processing right after the first missing required variable is detected

2019/03/13 10:42:54 required key MYAPP_FOO missing value

Feature Request

It would be really useful in some cases (most? all of them?) just to keep processing, in order to detect all missing required variables.

Motivation

Just imagine an app that have a bunch of required variables that won't start because a missing required variable. Then you fix that one that is missing, then run the app again... then fix another one, then run it again... over and over, until you finally realize all the ones that are missing on your runtime configuration (just after some laborious run-and-fix work).

teepark commented 5 years ago

I agree that would be a significant DX improvement. If you want to backport the change in ndrewnee/envconfig#3 I can see merging that PR.

TonyPythoneer commented 5 years ago

Hi @teepark This issue seems to get solved. It should get closed.

hbobenicio commented 4 years ago

It's not merged yet. And the PR is not resolved so... let's stick with it until then

hbobenicio commented 4 years ago

@teepark any insights here? the PR seems really simple. Can it be merged?