mirror of
https://github.com/therootcompany/golib.git
synced 2026-11-04 06:55:00 +00:00
fix: rename envfile flag to env-file with backwards compat
- Update peekOption to accept both env-file and envfile
- Add _ = fs.String("env-file", ...) flag definition
- Update comments to reference env-file
This commit is contained in:
parent
71671b7852
commit
92a2df244b
@ -108,8 +108,8 @@ func main() {
|
||||
QueryParamNames: nil, // []string{"access_token", "token"},
|
||||
}
|
||||
|
||||
// Peek for --envfile early
|
||||
envPath := peekOption(os.Args[1:], []string{"-envfile", "--envfile"}, ".env")
|
||||
// Peek for --env-file early
|
||||
envPath := peekOption(os.Args[1:], []string{"-env-file", "--env-file", "-envfile", "--envfile"}, ".env")
|
||||
_ = godotenv.Load(envPath) // silent if missing
|
||||
|
||||
// Override defaults from env
|
||||
@ -131,6 +131,7 @@ func main() {
|
||||
|
||||
// Flags
|
||||
fs := flag.NewFlagSet(name, flag.ContinueOnError)
|
||||
_ = fs.String("env-file", "", "path to .env file (or set $AUTHPROXY_ENV_FILE)")
|
||||
fs.BoolVar(&cli.ShowVersion, "version", false, "show version and exit")
|
||||
fs.IntVar(&cli.Port, "port", cli.Port, "port to listen on")
|
||||
fs.StringVar(&cli.Address, "address", cli.Address, "address to bind to (e.g. 127.0.0.1)")
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user