All Downloads are FREE. Search and download functionalities are using the official Maven repository.

io.dropwizard.configuration.EnvironmentVariableSubstitutor Maven / Gradle / Ivy

There is a newer version: 0.0.3
Show newest version
package io.dropwizard.configuration;

import org.apache.commons.lang3.text.StrSubstitutor;

/**
 * A custom {@link StrSubstitutor} using environment variables as lookup source.
 */
public class EnvironmentVariableSubstitutor extends StrSubstitutor {
    public EnvironmentVariableSubstitutor() {
        this(true, false);
    }

    public EnvironmentVariableSubstitutor(boolean strict) {
        this(strict, false);
    }

    /**
     * @param strict                  {@code true} if looking up undefined environment variables should throw a
     *                                {@link UndefinedEnvironmentVariableException}, {@code false} otherwise.
     * @param substitutionInVariables a flag whether substitution is done in variable names.
     * @see io.dropwizard.configuration.EnvironmentVariableLookup#EnvironmentVariableLookup(boolean)
     * @see org.apache.commons.lang3.text.StrSubstitutor#setEnableSubstitutionInVariables(boolean)
     */
    public EnvironmentVariableSubstitutor(boolean strict, boolean substitutionInVariables) {
        super(new EnvironmentVariableLookup(strict));
        this.setEnableSubstitutionInVariables(substitutionInVariables);
    }
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy