Module org.github.gestalt.core
Package org.github.gestalt.config.source
Class EnvironmentConfigSourceBuilder
- java.lang.Object
-
- org.github.gestalt.config.builder.SourceBuilder<EnvironmentConfigSourceBuilder,EnvironmentConfigSource>
-
- org.github.gestalt.config.source.EnvironmentConfigSourceBuilder
-
public final class EnvironmentConfigSourceBuilder extends SourceBuilder<EnvironmentConfigSourceBuilder,EnvironmentConfigSource>
ConfigSourceBuilder for the Class Path Config Source.Convert the Environment Variables to a property file. Apply the supplied transforms as we convert it. Then write that as an input stream for the next stage in the parsing.
-
-
Field Summary
-
Fields inherited from class org.github.gestalt.config.builder.SourceBuilder
configReloadStrategies, source, tags
-
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description ConfigSourcePackagebuild()Build the ConfigSourcePackage with the config source, tags and any reload strategies.static EnvironmentConfigSourceBuilderbuilder()Static function to create the builder.java.lang.StringgetPrefix()Get the prefix we scan for.booleanisFailOnErrors()Get if we should fail on errors for the config source.booleanisRemovePrefix()Get if we should remove the prefix in the environment variables.EnvironmentConfigSourceBuildersetFailOnErrors(boolean failOnErrors)Set if we should fail on errors for the config source.EnvironmentConfigSourceBuildersetPrefix(java.lang.String prefix)Set the prefix we scan for.EnvironmentConfigSourceBuildersetRemovePrefix(boolean removePrefix)Set if we should remove the prefix in the environment variables.-
Methods inherited from class org.github.gestalt.config.builder.SourceBuilder
addConfigReloadStrategy, addTag, buildPackage, getConfigReloadStrategies, getTags, self, setTags
-
-
-
-
Method Detail
-
builder
public static EnvironmentConfigSourceBuilder builder()
Static function to create the builder.- Returns:
- the builder
-
isFailOnErrors
public boolean isFailOnErrors()
Get if we should fail on errors for the config source.- Returns:
- if we should fail on errors for the config source
-
setFailOnErrors
public EnvironmentConfigSourceBuilder setFailOnErrors(boolean failOnErrors)
Set if we should fail on errors for the config source.- Parameters:
failOnErrors- Set if we should fail on errors for the config source.- Returns:
- the builder
-
getPrefix
public java.lang.String getPrefix()
Get the prefix we scan for. This will only include the environment variables that match the prefix.- Returns:
- the prefix we scan for.
-
setPrefix
public EnvironmentConfigSourceBuilder setPrefix(java.lang.String prefix)
Set the prefix we scan for. This will only include the environment variables that match the prefix.- Parameters:
prefix- the prefix we scan for.- Returns:
- the builder
-
isRemovePrefix
public boolean isRemovePrefix()
Get if we should remove the prefix in the environment variables.- Returns:
- If we should remove the prefix in the environment variables.
-
setRemovePrefix
public EnvironmentConfigSourceBuilder setRemovePrefix(boolean removePrefix)
Set if we should remove the prefix in the environment variables.- Parameters:
removePrefix- if we should remove the prefix in the environment variables.- Returns:
- the builder
-
build
public ConfigSourcePackage build() throws GestaltException
Description copied from class:SourceBuilderBuild the ConfigSourcePackage with the config source, tags and any reload strategies.- Specified by:
buildin classSourceBuilder<EnvironmentConfigSourceBuilder,EnvironmentConfigSource>- Returns:
- the ConfigSourcePackage with the config source, tags and any reload strategies.
- Throws:
GestaltException- exceptions if any of the required properties are not set.
-
-