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

Extend Usage to print values #77

Closed
AlekSi opened this issue Feb 6, 2017 · 4 comments
Closed

Extend Usage to print values #77

AlekSi opened this issue Feb 6, 2017 · 4 comments

Comments

@AlekSi
Copy link
Contributor

AlekSi commented Feb 6, 2017

This way Usage() can be used after processing to print applied configuration as a better-looking alternative to fmt.Printf("%+v\n", config).

@teepark
Copy link
Collaborator

teepark commented Feb 6, 2017

This seems like a debugging use case? I can understand applications needing to:

  1. parse configuration from the environment
  2. print helpful output documenting supported environment vars and their types

I'm trying to wrap my head around the need for this or find precedent anywhere else. It would be like if someapp -t -a -N 2 -h printed help output informing the user that they activated the "t" and "a" flags, and that the "N" value is 2.

@relistan
Copy link
Contributor

relistan commented Mar 27, 2017

I think @AlekSi might be trying to solve the problem of "What the heck actually got applied from the env vars I passed" because it can be challenging to figure out which were actually picked up. I wrote a thing which we use to solve that: https://github.com/relistan/rubberneck

Configure your app with envconfig, and then on startup have it dump the config it's running from to the logs. You could also do this from a CLI switch if needed. I find it useful. Maybe it solves this problem and it doesn't need to be solved in envconfig. You could alternatively dump a TOML or YAML file from your config struct if you don't like Rubberneck.

@teepark
Copy link
Collaborator

teepark commented Mar 27, 2017

@relistan that package looks great! I agree it's not really the job of envconfig -- I'll be pointing people to rubberneck next time this comes up.

@teepark teepark closed this as completed Mar 27, 2017
@relistan
Copy link
Contributor

Thanks @teepark!

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

3 participants