public class SpincastConfigPluginConfigDefault extends Object implements SpincastConfigPluginConfig
WARNING : Beware of circular dependencies here... In general, this component should not depend on anything else, since pretty much all other components depend on it.
One dependency you can use, is
@MainArgs String[]
(or @MainArgs List<String>) to get access to
the application arguments.
| Modifier and Type | Field and Description |
|---|---|
static String |
CONFIG_FILE_NAME_DEFAULT |
static String |
PREFIX_DEFAULT |
| Constructor and Description |
|---|
SpincastConfigPluginConfigDefault() |
| Modifier and Type | Method and Description |
|---|---|
String |
getClasspathFilePath()
The path to a configuration file to load from the
classpath.
|
List<String> |
getEnvironmentVariablesPrefixes()
The allowed prefixes an environment variable can have
to be used as a configuration.
|
String |
getExternalFilePath()
The path to a configuration file to load from the
file system.
|
List<String> |
getSystemPropertiesPrefixes()
The allowed prefixes a system property can have
to be used as a configuration.
|
boolean |
isEnvironmentVariablesStripPrefix()
Should the prefix of an environment variable be stripped?
For example, if
#environmentVariablesPrefixes indicates
that "app." is an environment variable prefix, then "app.admin.email"
will result in a "admin.email" key. |
boolean |
isExternalFileConfigsOverrideEnvironmentVariables()
If an external configuration file is used and
environment variables too, should configurations
from the file override those from environment variables?
|
boolean |
isSystemPropertiesStripPrefix()
Should the prefix of an system property be stripped?
For example, if
#systemPropertiesPrefixes indicates
that "app." is an system property prefix, then "app.admin.email"
will result in a "admin.email" key. |
boolean |
isThrowExceptionIfSpecifiedClasspathConfigFileIsNotFound()
Should an exception be thrown if a classpath config file is specified
(is not
null) but is not found. |
boolean |
isThrowExceptionIfSpecifiedExternalConfigFileIsNotFound()
Should an exception be thrown if an external config file is specified
(is not
null) but is not found. |
public static final String CONFIG_FILE_NAME_DEFAULT
public static final String PREFIX_DEFAULT
public String getClasspathFilePath()
SpincastConfigPluginConfig
Defaults to "app-config.yaml".
This means you can simply create that file
in your /src/main/resources/ folder and it
will be used.
getClasspathFilePath in interface SpincastConfigPluginConfigpublic String getExternalFilePath()
SpincastConfigPluginConfig
The path can be relative or absolute. Spincast will check
this using :
File configFile = new File(thePath);
if(configFile.isAbsolute()) {...}
If the path is relative, it is from the executable .jar.
Defaults to "app-config.yaml".
getExternalFilePath in interface SpincastConfigPluginConfigpublic List<String> getEnvironmentVariablesPrefixes()
SpincastConfigPluginConfig
Defaults to "app.".
getEnvironmentVariablesPrefixes in interface SpincastConfigPluginConfignull to
disable environment variables as a source for configurations.public boolean isEnvironmentVariablesStripPrefix()
SpincastConfigPluginConfig#environmentVariablesPrefixes indicates
that "app." is an environment variable prefix, then "app.admin.email"
will result in a "admin.email" key.
Defaults to false.
isEnvironmentVariablesStripPrefix in interface SpincastConfigPluginConfigpublic List<String> getSystemPropertiesPrefixes()
SpincastConfigPluginConfig
Defaults to "app.".
getSystemPropertiesPrefixes in interface SpincastConfigPluginConfignull to
disable system properties as a source for configurations.public boolean isSystemPropertiesStripPrefix()
SpincastConfigPluginConfig#systemPropertiesPrefixes indicates
that "app." is an system property prefix, then "app.admin.email"
will result in a "admin.email" key.
Defaults to false.
isSystemPropertiesStripPrefix in interface SpincastConfigPluginConfigpublic boolean isExternalFileConfigsOverrideEnvironmentVariables()
SpincastConfigPluginConfig
The default is false : environment
variables have priority.
isExternalFileConfigsOverrideEnvironmentVariables in interface SpincastConfigPluginConfigpublic boolean isThrowExceptionIfSpecifiedClasspathConfigFileIsNotFound()
SpincastConfigPluginConfignull) but is not found.
If set to false, a message will be logged but no
exception will be thrown.
Defaults to false.
isThrowExceptionIfSpecifiedClasspathConfigFileIsNotFound in interface SpincastConfigPluginConfigpublic boolean isThrowExceptionIfSpecifiedExternalConfigFileIsNotFound()
SpincastConfigPluginConfignull) but is not found.
If set to false, a message will be logged but no
exception will be thrown.
Defaults to false.
isThrowExceptionIfSpecifiedExternalConfigFileIsNotFound in interface SpincastConfigPluginConfigCopyright © 2018. All rights reserved.