Environment and command line flags
DRuggeri opened this issue · 3 comments
Is it compatible with the philosophy of this toolkit to support the use of command line and environment entry overrides? I maintain a handful of exporters that take TLS and basic auth information via both methods.
Proposed command line flags:
--web.tls.cert_file
--web.tls.key_file
--web.auth.userfoo=hashbar
Proposed ENV flags flags:
WEB_TLS_CERT_FILE
WEB_TLS_KEY_FILE
WEB_AUTH_USERFOO=HASHBAR
I'd be happy to contribute a pull request to add this functionality, but wanted to verify it would be acceptable first.
I personally dislike env vars used in this way. I find it really messy.
Hey @SuperQ, ignoring whether settings from the config file should also be added to the CLI, would you be open to adding a way to configure the web.config.file
via environment variable? Many exporters are run in containers without an easy way to configure CLI flags, and environment variables solve that problem.
I propose adding support for the environment variable WEB_CONFIG_FILE
. If you would prefer not to modify the default behavior, this could optionally be enabled with a feature flag on AddFlags
.
Without this, I've had to reimplement the web.confilg.file
option in exporters I maintain. While this really isn't a big deal for a single flag, it potentially means on going work as exporter-toolkit evolves.
Happy to send a PR if that helps.
Thanks!
No, I don't think supporting ENV vars makes sense. This is a fairly opinionated library meant to make sure that exporters are implemented in a specific way to make the use of exporters consistent with each other.