You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: README.md
+8-7Lines changed: 8 additions & 7 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -1,6 +1,6 @@
1
1
# envparser
2
2
3
-
[](https://github.com/trebent/envparser/actions/workflows/build.yaml)
Declare your application environment variables in a standardised way!
6
6
@@ -9,6 +9,7 @@ Declare your application environment variables in a standardised way!
9
9
Tired of inconsistent environment variable handling 😮💨? Tired of having to use `os.LookupEnv` and implementing parsing every time you need to extract a value 😩? Are you especially tired of seeing duplicate code blocks when variables are used in more than one place 😤? Enter standardized environment variable parsing!
10
10
11
11
A stepwise instruction for a better way of life:
12
+
12
13
1. Define a place where you want your environment variables to be declared. This could be your application's main entrypoint, or a separate `env` package, whatever your heart desires.
13
14
2. Register your environment variables in the chosen place. Determine which are required and their datatypes.
14
15
3. Call `Parse()` and your declared variables are good to go.
@@ -32,12 +33,12 @@ var (
32
33
funcmain() {
33
34
// Output the environment parser help text to stdout when --help is executed.
34
35
flag.CommandLine.SetOutput(os.Stdout)
35
-
flag.Usage = func() {
36
-
fmt.Fprintf(flag.CommandLine.Output(), "Usage of %s:\n", os.Args[0])
0 commit comments