envconfig icon indicating copy to clipboard operation
envconfig copied to clipboard

Feature Request: Continue processing after missing required values

Open hbobenicio opened this issue 5 years ago • 4 comments

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).

hbobenicio avatar Mar 13 '19 14:03 hbobenicio

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.

teepark avatar May 24 '19 18:05 teepark

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

TonyPythoneer avatar Aug 18 '19 13:08 TonyPythoneer

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

hbobenicio avatar Dec 16 '19 12:12 hbobenicio

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

hbobenicio avatar Jun 23 '20 17:06 hbobenicio