Skip to content

Latest commit

 

History

History

viper

Folders and files

NameName
Last commit message
Last commit date

parent directory

..
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Configurations Loading using Viper and PFlag

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 -.

Setup

<<<<<<< Updated upstream

  1. Build the program.

    $ make
  2. Run the program

    $ CYBER_DIRECTORY=env bin/viper --postgres-url=arg
    Dump of config: {true 5000 arg env default}

Reference and Credits