An example of implementing configurations in an application using the viper
and pflag
packages.
- CLI arguments (top precedence)
- environment variables
- configuration file
- default values
The pflag
package can be configured to allow POSIX/GNU style --
flags or the short form flags -
.
<<<<<<< Updated upstream
-
Build the program.
$ make
-
Run the program
$ CYBER_DIRECTORY=env bin/viper --postgres-url=arg Dump of config: {true 5000 arg env default}