Environment Aliases

Custom Environment Variables

Environment variables work as reusable placeholders for frequently used values and strings. The platform provides default variables, and you can also add custom variables through the dashboard, shell configuration files, or Java configuration files.

Customize Variables through the Dashboard

1Open the Variables section

Hover over the required node group in the dashboard, expand Additionally, and select Variables.

Environment variables option in dashboard
Open the Variables section from the node-group actions.

2Add, edit, or remove variables

Use the toolbar in the opened panel to manage the environment-variable list according to your application requirements.

Manage environment variables in dashboard
Add, edit, or remove environment variables from the dashboard.
Variable references: Existing environment variables can be referenced while defining another variable. For example, a value containing $HOME is resolved according to the current HOME variable.

Click Apply after completing the required changes.

Set Variables through Shell Configuration

Custom variables can also be defined through standard shell configuration files:

  • ~/.bash_profile is executed when the user signs in through the console.
  • ~/.bashrc is executed for every new Bash session.

The platform includes the .bashrc source from .bash_profile, so custom variables can normally be maintained in .bashrc.

1Connect to the container

Establish an SSH connection. The embedded Web SSH client can be opened directly from the dashboard.

Web SSH button
Open the embedded Web SSH client.

2Add custom variables

Create or edit ~/.bashrc and add variables using the following format:

export {var_name}={var_value}
  • {var_name} — name of the custom variable.
  • {var_value} — value assigned to the variable.
Export custom variables through shell
Define custom variables in the shell configuration file.

3Apply and verify the variables

New Bash sessions load the variables automatically. To apply them to the current session immediately, reload the configuration and print the variable value:

source ~/.bashrc
echo ${var_name}
Verify custom environment variables
Reload the shell configuration and verify the custom variable.

Adjust Java Variables through Configuration Manager

The following workflow applies to platform-managed Java application servers.

1Open Configuration Manager

Click Config beside the Java application server to open the built-in file manager.

Configuration file manager button
Open the configuration file manager for the Java server.

Navigate to variables.conf at the appropriate stack-specific location:

  • Tomcat and TomEE: /opt/tomcat/conf/variables.conf
  • Jetty: /opt/jetty/etc/variables.conf
  • Spring Boot: /opt/shared/conf/variables.conf
  • GlassFish: /opt/glassfish/glassfish/domains/domain1/config/variables.conf
  • Payara: /opt/payara/glassfish/domains/domain1/config/variables.conf
  • WildFly: /opt/wildfly/conf/variables.conf

2Add Java variables or JVM properties

Enter each value on a separate line or separate the values with spaces. For example:

-Dvar1=value1 -Dvar2=value2
-Dmy.var3=/my/value
Custom Java environment variables
Add custom Java properties in variables.conf.
GlassFish, Payara, and WildFly also provide administration panels that can be used to add JVM options and custom variables.
GlassFish custom JVM variables
Add custom JVM options through the GlassFish administration panel.

Save the configuration after making the required changes.

3Restart the Java nodes

Restart the application-server nodes to apply the new variables.

Restart Java nodes
Restart the nodes after updating the Java configuration.

The values can then be retrieved in Java through System.getProperty():

String var1 = System.getProperty("var1");
String var2 = System.getProperty("var2");
String var3 = System.getProperty("my.var3");
Application note: Use shell variables for shell processes and Java system properties for JVM-based applications. The two mechanisms are configured and read differently.

What’s next?

  • Default Environment Variables
  • Java Options and Arguments
  • Container Variables
  • Configuration File Manager