public class EnvironmentVariables implements Configuration
Configuration looked up in the environment variables of the process.
Key names are translated from lower-case and periods convention to environment variable names with upper-case and underscore convention, with an optional prefix.
E.g. if the EnvironmentVariables instance is initialised a prefix of "APP", the key name "db.password" will be translated to "APPDBPASSWORD".
Configuration.DefaultImpls| Constructor and Description |
|---|
EnvironmentVariables(java.lang.String prefix,
kotlin.jvm.functions.Function1<? super java.lang.String,java.lang.String> lookup,
kotlin.jvm.functions.Function0<? extends java.util.Map<java.lang.String,java.lang.String>> all)
Configuration looked up in the environment variables of the process.
|
EnvironmentVariables()
Configuration looked up in the environment variables of the process.
|
| Modifier and Type | Method and Description |
|---|---|
boolean |
contains(Key<?> key) |
<T> T |
get(Key<? extends T> key)
Look up a property value identified by key, or throw
class Misconfiguration if there is no definition of the
property. Implementations can override missingPropertyMessage to provide a more detailed error message
for the exception. |
Location |
getLocation() |
<T> T |
getOrElse(Key<? extends T> key,
T p)
Look up a property value identified by key, or return default with the key if there is no definition of the
property.
|
<T> T |
getOrElse(Key<? extends T> key,
kotlin.jvm.functions.Function1<? super com.natpryce.konfig.Key<?extendsT>,? extends T> p)
Look up a property value identified by key, or call default with the key if there is no definition of the
property.
|
<T> T |
getOrNull(Key<? extends T> key)
Look up a property value identified by key, or return
null if there is no definition of the
property. |
java.lang.String |
getPrefix() |
java.util.List<kotlin.Pair> |
list() |
NonExistentClass |
searchPath(Key<?> key)
Report the locations that will be searched for a configuration property, in priority order. The value used
is taken from the first location in the list that contains a mapping for the key.
|
contains, get, getOrElse, getOrElse, getOrNull, list, searchPathpublic EnvironmentVariables(java.lang.String prefix,
kotlin.jvm.functions.Function1<? super java.lang.String,java.lang.String> lookup,
kotlin.jvm.functions.Function0<? extends java.util.Map<java.lang.String,java.lang.String>> all)
Configuration looked up in the environment variables of the process.
Key names are translated from lower-case and periods convention to environment variable names with upper-case and underscore convention, with an optional prefix.
E.g. if the EnvironmentVariables instance is initialised a prefix of "APP", the key name "db.password" will be translated to "APPDBPASSWORD".
public EnvironmentVariables()
Configuration looked up in the environment variables of the process.
Key names are translated from lower-case and periods convention to environment variable names with upper-case and underscore convention, with an optional prefix.
E.g. if the EnvironmentVariables instance is initialised a prefix of "APP", the key name "db.password" will be translated to "APPDBPASSWORD".
public Location getLocation()
public <T> T getOrNull(Key<? extends T> key)
Look up a property value identified by key, or return null if there is no definition of the
property.
public NonExistentClass searchPath(Key<?> key)
Report the locations that will be searched for a configuration property, in priority order. The value used is taken from the first location in the list that contains a mapping for the key.
public java.util.List<kotlin.Pair> list()
public java.lang.String getPrefix()
public <T> T get(Key<? extends T> key)
Look up a property value identified by key, or throw class Misconfiguration if there is no definition of the
property. Implementations can override missingPropertyMessage to provide a more detailed error message
for the exception.
class Misconfigurationpublic <T> T getOrElse(Key<? extends T> key, T p)
Look up a property value identified by key, or return default with the key if there is no definition of the property.
public <T> T getOrElse(Key<? extends T> key, kotlin.jvm.functions.Function1<? super com.natpryce.konfig.Key<?extendsT>,? extends T> p)
Look up a property value identified by key, or call default with the key if there is no definition of the property.
public boolean contains(Key<?> key)