-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathdoc.go
More file actions
19 lines (13 loc) · 731 Bytes
/
doc.go
File metadata and controls
19 lines (13 loc) · 731 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
/*
Package envflag facilitates setting standard Go flags using environment variables.
Basic usage
Simply replace the typical call to flag.Parse() with envflag.Parse(). Flag names are mapped to environment variables
by converting them to uppercase, and replacing dashes with underscores (e.g. `my-flag` => `MY_FLAG`). Command-line
arguments will take precedence over environment variables where both are specified.
Advanced usage
You can customise the behaviour of envflag by passing in options to the Parse() method. For example, to add a prefix
to all environment variables:
envflag.Parse(envflag.WithPrefix("MYAPP_"))
This will map a flag named `my-flag` to the environment variable `MYAPP_MY_FLAG`.
*/
package envflag