kelseyhightower / envconfig

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

Exporting gatherInfo() #97

Closed dewrich closed 6 years ago

dewrich commented 6 years ago

Would be nice to have this available so that I could build a command line Usage for the Environment Variables that are available to override.

For example, you could build a mapping of the env vars defined in your struct to some Usage doc that describes the fields individually.

https://github.com/kelseyhightower/envconfig/blob/462fda1f11d8cad3660e52737b8beefd27acfb3f/envconfig.go#L57

teepark commented 6 years ago

Hi @dewrich! Envconfig is really targeted at doing a specific job rather than being an environment variable swiss-army knife. IMO it's better to keep the API surface low rather than exposing internals to cover every possible use-case.

That being said, your example of building a usage doc is already possible with the Usage family of functions: Usage, Usagef, or Usaget for maximum control.