Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
View Source
var ( DefaultConfigName = "config.local.yaml" DefaultConfigPath = "./configs/" ConfigFileEnv = "CONFIG_FILE" ConfigFileKey = "config-file" ConfigPathEnv = "CONFIG_PATH" ConfigPathKey = "config-path" )
Functions ¶
func Load ¶
func Load(namespace string, target interface{}, defaults map[string]interface{}, logger *logrus.Logger) error
Load configuration from YAML files and environment variables with provided defaults. Sets the values to `target` struct in following order:
- Values from `defaults`.
- Values from yaml files under specified `namespace`.
- Values from environment variables, for example NAMESPACE_DB_PORT=5000 for `namespace.db.port` key.
It does NOT return an error if CONFIG_FILE is not set and config.local.yaml doesn't exist, but does return an error if CONFIG_FILE is set and any of files are not presented or malformed.
Types ¶
This section is empty.
Click to show internal directories.
Click to hide internal directories.