Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Feature request] Print all unset environment variable #22

Closed
mszostok opened this issue Apr 5, 2019 · 2 comments
Closed

[Feature request] Print all unset environment variable #22

mszostok opened this issue Apr 5, 2019 · 2 comments

Comments

@mszostok
Copy link

mszostok commented Apr 5, 2019

Description

Right now parsing the environment variable process is failing fast. That's mean that only first uninitialized env is printed. If you have 5 environments variable then you can even need to execute the application 5 times to get info about all variables. I know that every application should have proper documentation but still, IMO it will be super useful to have an option to change that behavior and print all unset environment right after the first execution.

Details

Assumption that app has the following config:

type Config struct {
	Debug             bool
	ClientID          string
}

and user didn't provide both envs.

Current solution
Output:

envconfig: keys DEBUGBB, DEBUG_BB, debug_bb, debugbb not found

Desired solution

Add new option param

	envconfig.InitWithOptions(&conf, envconfig.Options{
		PrintAllUnsetEnvs: true,
	})

Output:

envconfig:
	* key DEBUG not found
	* keys CLIENTID, CLIENT_ID, client_id, clientid not found

I you will agree with me then I can also provide the implementation for that.

@vrischmann
Copy link
Owner

Hello, sorry for the time it took to respond.

I'm on the fence on this. On one hand I think it would be relatively useful, on the other hand I'm not sure it's worth it for a use case which will in my opinion be limited in scope.

I'm also not sure if it's worth complexifying the code for this. If it doesn't require modifying a lot of code I'll be more willing to merge it but I'm not sure.
Do you already have an implementation ready that I could review ?

@vrischmann
Copy link
Owner

I'm going to close since there's been no news for a couple months.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants