Open Shrumplestiltskin opened 5 years ago
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
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
true, I'm just thinking ahead as people might want a config file in the future
It looks like kingpin also has an option to read args from the config file: https://godoc.org/github.com/alecthomas/kingpin#ExpandArgsFromFile
I think the problem with Kingpin was easily overriding, based on flag/file/env etc. See this issue https://github.com/alecthomas/kingpin/issues/208, however it looks like something has been implemented to try and make this better https://github.com/alecthomas/kingpin/pull/209, so that could be worth a look. Although it's only on v3-unstable
branch
It could be advantageous in some instances to have variables read from the container environment rather than passing command flags to the binary.