Documentation
¶
Overview ¶
Package config allows you to use an environment based configuration file with ability to interpolate environment variables inside the configuration file. e.g. ./config.yml
default: &default
database: awesome_{{.GOENV}}
mongo:
host: localhost:3030
username: foob
password: boof
development:
<<: *default
production:
<<: *default
mongo:
host: {{.MONGO_URL}}
username: {{.MONGO_USER}}
password: {{.MONGO_PASSWORD}}
Index ¶
Constants ¶
This section is empty.
Variables ¶
View Source
var ( //GOENV holds the current value if it is invoked with it. //e.g. GOENV=test go run * will set GOENV to test. //if the app is invoked without any GOENV it is set to the DEFAULTENV. GOENV string //DEFAULTENV is set to development by default but you can change this //before calling config.Load to change the default GOENV value. DEFAULTENV = "development" )
Functions ¶
func Load ¶
Load allows you to read the configuration from an io.Reader instead of a file. Check the LoadFromFile function for more information on arguments.
func LoadFromFile ¶
Types ¶
This section is empty.
Click to show internal directories.
Click to hide internal directories.