configs

package
v0.0.3 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Apr 29, 2022 License: MIT Imports: 4 Imported by: 0

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.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL