Go example project for using environment variables
Switch branches/tags
Nothing to show
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Failed to load latest commit information.
.env
.gitignore
.travis.yml
Gopkg.lock
Gopkg.toml
LICENSE
README.md
main.go

README.md

Environment Variables Example

Build Status

Really tiny and simple example about using both envconfig and godotenv as a prerequisite for a 12 factor application.

Usage

Without indicating any environment variable it uses the default values:

$ ./env-vars-example
root:@localhost:3306/dbname

but if you set the environment variables, those take preference:

$ DSN_USERNAME=mario DSN_HOST=fancy.com ./env-vars-example
mario:@fancy.com:3306/dbname