package
module
Version:
v0.3.0
Opens a new window with list of versions in this module.
Published: Nov 30, 2022
License: MIT
Opens a new window with license information.
Imports: 9
Opens a new window with list of imports.
Imported by: 0
Opens a new window with list of known importers.
README
¶
config Eloquent configuration for Golang apps.
Features:
- Substitutes
$VARIABLE
and ${VARIABLE}
with variables found in a shell environment.
- Syntaxes for setting up default values and specifying mandatory variables:
- ${VARIABLE:-default} evaluates to default if VARIABLE is unset or empty in the environment.
- ${VARIABLE-default} evaluates to default only if VARIABLE is unset in the environment.
- ${VARIABLE:?err} panics with an error message containing err if VARIABLE is unset or empty in the environment.
- ${VARIABLE?err} panics with an error message containing err if VARIABLE is unset in the environment.
Examples:
Documentation
¶
View Source
const (
YAML = "yaml"
JSON = "json"
TOML = "toml"
)
Supported configuration file formats.
Should be used as a second argument to Load.
View Source
var OverwriteEnvPrefix = "CONFIG_OVERWRITE_"
Load reads configuration data encoded in the format specified by configType from in
and unmarshals it into v.
Load returns an error when data is in wrong or unsupported format,
or when it failed to unmarshal data into v.
LoadFile reads configuration data from the named file
and unmarshals it into v.
Internally it calls Load.
Source Files
¶
Directories
¶
Click to show internal directories.
Click to hide internal directories.