MainApi
Attributes
- Graph
- Supertypes
Members list
Value members
Concrete methods
A function to transform the name of an environment variable into a configuration path.
A function to transform the name of an environment variable into a configuration path.
This can be overridden to globally change the behavior instead of
overriding it in every call of read
.
Attributes
Configuration readers for file extensions.
Configuration readers for file extensions.
This can be overridden to globally change the behavior instead of
overriding it in every call of read
.
Attributes
Read a configuration from various sources and formats.
Read a configuration from various sources and formats.
The configuration will be the result of merging configuration objects in the order of the parameters of this method. I.e.
- start by reading files and directories
- add configurations from environment variables
- add configurations from system properties
- add configuration from command line arguments
Merging of configuration objects means that object's keys are merged recursively. Other types however are replaced. Example:
Original
{
"a": "lhs"
"b": {
"inner": {
"foo": "lhs"
}
}
}
merge with
{
"b": {
"inner": {
"foo": "rhs"
}
}
"c": "rhs"
}
results in
{
"a": "lhs"
"b": {
"inner": {
"foo": "rhs"
}
}
"c": "rhs"
}
Attributes
- args
Command line arguments that should be interpreted as configurations.
- dest
Root configuration object into which all other configuration will be merged. This can be set to build configurations through multiple calls to
read
. Defaults to an empty configuration.- env
Environment variables available for reading. Note that by default none will be read, unless other
env*
parameters are specified. Defaults to system environment variables.- envBinds
An association of environment variables to configuration paths. This is used to manually bind environment variables, for example if the prefix approach cannot be used. For example if the env contains
SOME_SETTING=1
and the bindings contain"SOME_SETTING" -> "foo.bar"
, then this will result in the configurationfoo.bar=1
- envKeyReplacer
A function to transform the name of an environment variable into a configuration path. This overrides the default
defaultEnvKeyReplacer
if set.- envPrefix
Automatically read environment variables starting with this prefix, if set. Any environment variables read in such a way will have the prefix stripped before being transformed into a configuration path via the
envKeyReplacer
. For example if the env containsAPP_FOO_BAR=1
and the prefix is given asAPP_
, then this will result in the configurationfoo.bar=1
.- paths
Paths of configuration files or directories containing config files. In case a path is a directory, it will be traversed for config files sorted in lexicographical order (only one level deep). In case a path is a file, it will be parsed based on extension. See the
readers
param.- props
System properties available for reading. Note that by default none will be read, unless other
props*
parameters are specified. Defaults to the current runtime's properties (on the JVM).- propsBinds
An association of properties to configuration paths. This is used to manually bind properties, for example if the prefix approach cannot be used. For example if the properties contain
some.property=1
and the bindings contain"some.property" -> "foo.bar"
, then this will result in the configurationfoo.bar=1
- propsPrefix
Automatically read system properties starting with this prefix, if set. Any properties read in such a way will have the prefix stripped before being read as a configuration path. For example if the properties contain
app.foo.bar=1
and the prefix is given asapp.
, then this will result in the configurationfoo.bar=1
.- pwd
Root directory to use if files are given as relative paths. Defaults to current working directory.
- readers
Additional readers for file extensions. See
defaultReaders
in the API trait.