Runtime configuration file can be dynamized using environment variables and Java Properties.
When starting, the Runtime will automatically retrieve and use the specified variables, with a mechanism allowing to specify a default value if it does not exist.
Prerequisites:
- Stambia DI Runtime S17.6.2 or higher
Using environment variables and Java Properties
When administering the Runtime configuration file (engineParameters.xml), the following syntax must be used:
${java.property|environment.variable:<VARIABLE_NAME>[:<DEFAULT_VALUE>]}
It is composed of the three colored parts below:
${java.property|environment.variable:<VARIABLE_NAME>[:<DEFAULT_VALUE>]}
Description of each part:
Part | Mandatory | Description |
java.property | environment.variable | yes |
Type of variable to use between the following two types. Java.property Java Property available in the Java process started for the Runtime. These can be either System Properties or user defined properties transmitted through -Doption=value on the Runtime startup Java command. environment.variable Environment variables available in the machine. |
VARIABLE_NAME | yes | Name of the variable to retrieve |
DEFAULT_VALUE | no |
Optional default value to use if the variable does not exist. If no default value is specified an error will be thrown at Runtime startup if the variable does not exist. |
Environment variables and Java Properties can be used for any value the Runtime Configuration file.
Examples
Using an environment variable to define the Runtime RMI Port
<parameters> <...> <engineParameters> <...> <parameter name="rmiPort" value="${environment.variable:STB_RUNTIME_PORT}"/> <...> </engineParameters> <...> </parameters>
Using an environment variable to define the Runtime RMI Port, with a default value
<parameters> <...> <engineParameters> <...> <parameter name="rmiPort" value="${environment.variable:STB_RUNTIME_PORT:42000}"/> <...> </engineParameters> <...> </parameters>
Using a Java Property to add the user name inside the temporary folder path:
<parameters> <...> <engineParameters> <...> <parameter name="temporaryFolder" value="temp/${java.property:user.name"/> <...> </engineParameters> <...> </parameters>
Using a Java Property to add the user name inside the temporary folder path, with a default value:
<parameters> <...> <engineParameters> <...> <parameter name="temporaryFolder" value="temp/${java.property:user.name:default"/> <...> </engineParameters> <...> </parameters>