Class EnvironmentVariable
java.lang.Object
com.inductiveautomation.ignition.common.config.EnvironmentVariable
EnvironmentVariable assists with resolving environment variables and provides some utility behavior for detecting
presence, resolving values, and performing simple value translation/mapping.
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic class
static class
-
Method Summary
Modifier and TypeMethodDescriptiongetEnv()
static String
Helper method to retrieve environment variable value based on a specified key (name)getName()
getValue()
boolean
Checks if a fallback default value was applied during environment variable resolution due to either a missing environment variable or an expected pattern mis-match.boolean
Checks if env var was found in environment.static EnvironmentVariable.Builder
Create an EnvironmentVariable builder with environment variable name `envKey`newEnvVars
(List<Pattern> envKeyPatterns) newEnvVars
(Pattern envKeyPattern) Create an EnvironmentVariable bulk builder to retrieve all env vars matching a RegEx Pattern
-
Method Details
-
getEnv
Helper method to retrieve environment variable value based on a specified key (name)- Parameters:
key
- the name of the environment variable to retrieve- Returns:
- The environment variable value as a String, possibly Null
-
getEnv
-
getName
- Returns:
- the base name of the environment variable
-
getNameFile
- Returns:
- the _FILE suffix name of the environment variable (will attempt to resolve first)
-
getValue
- Returns:
- substituted (if applicable) value of the resolved env var, or default if defined, otherwise null
-
isFoundInEnv
public boolean isFoundInEnv()Checks if env var was found in environment. Use this to check if the environment variable was defined with any value. If you also want to determine if the fallback value was applied due to an expected pattern mismatch, useisDefaultValueUsed()
.- Returns:
- true if environment variable was found in the environment and matches an applied pattern (if applicable)
-
isDefaultValueUsed
public boolean isDefaultValueUsed()Checks if a fallback default value was applied during environment variable resolution due to either a missing environment variable or an expected pattern mis-match.- Returns:
- true if fallback default was applied
-
newEnvVar
Create an EnvironmentVariable builder with environment variable name `envKey`- Parameters:
envKey
- name of the environment variable to be resolved- Returns:
- a Builder for EnvironmentVariable
-
newEnvVars
Create an EnvironmentVariable bulk builder to retrieve all env vars matching a RegEx Pattern- Parameters:
envKeyPattern
- RegEx Pattern object that will be used to match available Env Vars- Returns:
- a BulkBuilder for EnvironmentVariable
-
newEnvVars
-