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

Read Variables from ENV #25

Open
Shrumplestiltskin opened this issue Dec 17, 2018 · 5 comments
Open

Read Variables from ENV #25

Shrumplestiltskin opened this issue Dec 17, 2018 · 5 comments

Comments

@Shrumplestiltskin
Copy link

It could be advantageous in some instances to have variables read from the container environment rather than passing command flags to the binary.

@Joseph-Irving
Copy link
Contributor

Yeah, this seems like a reasonable thing to do, might look at switching to https://github.com/spf13/viper so that we can easily switch between flags, env and config file

@arnitolog
Copy link

I guess you don't need to switch to any other packet since you are already using kingpin. So you can easily add Env Vars:
vaultAddr = kingpin.Flag("vault-addr", "Vault address, e.g. https://vault:8200").Envar("VAULT_ADDR").String()
https://godoc.org/github.com/alecthomas/kingpin#FlagClause.Envar

@Joseph-Irving
Copy link
Contributor

true, I'm just thinking ahead as people might want a config file in the future

@arnitolog
Copy link

It looks like kingpin also has an option to read args from the config file:
https://godoc.org/github.com/alecthomas/kingpin#ExpandArgsFromFile

@Joseph-Irving
Copy link
Contributor

I think the problem with Kingpin was easily overriding, based on flag/file/env etc. See this issue alecthomas/kingpin#208, however it looks like something has been implemented to try and make this better alecthomas/kingpin#209, so that could be worth a look. Although it's only on v3-unstable branch

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