Class VariableResolverUtil

java.lang.Object
com.tridion.configuration.VariableResolverUtil

public class VariableResolverUtil extends Object
Small utility class for resolving variables in the configuration file.
  • Method Details

    • resolveValue

      public static String resolveValue(String value)
      Resolves the variable pattern '${}' to a real value if present in the system properties.

      Supports default values using '${placeholder:-default} if placeholder is undefined, supports hidden fields using '${placeholder:-*HIDDEN*}' which prevents the value being logged for security reasons, also supports substrings before or/and after value which should be resolved 'value${placeholder}' or '${placeholder}value' or 'value${placeholder}value'.

      The system properties should include the environment variables and jvm startup properties ('-D').

      Parameters:
      value - The potential variable value to resolve
      Returns:
      The resolved value, if the input is not a (valid) variable or not present it returns the original value.
    • getEnvironmentVariable

      public static String getEnvironmentVariable(String variableName)
    • getPropertyFromPropertiesFile

      public static String getPropertyFromPropertiesFile(String propertyFilePath, String propName)
    • getEnvironmentVariableAndDecrypt

      public static String getEnvironmentVariableAndDecrypt(String variableName)