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

Variables with an override don't play nice with logs from Usage and Process #90

Open
cv711 opened this issue Jul 3, 2017 · 3 comments

Comments

@cv711
Copy link

cv711 commented Jul 3, 2017

Let's say I define a bunch of variables but one of them has an override e.g.

LogLevel string desc:"Log level override" envconfig:"LOG_LEVEL"

then I would expect that a call to envconfig.Usage("CMD", &cfg) should print it as LOG_LEVEL ..., instead of that I get CMD_LOG_LEVEL.

Same thing seems to be happening with the error from envconfig.Process("CMD", &cfg). When missing a required variable with an override I get required key CMD_LOG_LEVEL missing value as a message.

Thanks,
Chris

@teepark
Copy link
Collaborator

teepark commented Sep 18, 2017

You're totally right here. I believe the code would accept either <prefix>_<name> or just <name> (when tagged with "envconfig"), but the non-prefixed version should definitely be favored. I'd happily merge a PR that fixed this :)

@TonyPythoneer
Copy link

@cv711 Please read README.md. There is sufficient information to resolve your question.

@teepark This issue should get closed.

@ronniel1
Copy link

ronniel1 commented Jul 7, 2020

@TonyPythoneer I also need to have the Usage() print the alternate names instead of the key.
I looked at the README.md and did not find the info on how to do it.
Can you point me in the right direction?

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

Successfully merging a pull request may close this issue.

4 participants