Custom Environment Variables
This guide has been reviewed and reformatted for Ruk-Com Cloud PaaS. Screens may vary slightly by platform version.
Click or tap a screenshot to view it at its original size.
Objective
This guide explains how to use Custom Environment Variables on Ruk-Com Cloud PaaS, with ordered procedures and practical verification points.
Before you begin
- Sign in with an account permitted to manage the relevant environment.
- Confirm the target environment, region and resources before saving changes.
- Create a backup or rollback plan before changing a production system.
Environment variables represents a nice placeholder where you can store frequently used parameters or strings so that you don't have to manually specify the code each time you need it, and it has a number of predefined environment variables. The code can be imported into your application or even modified before node creation to implement optimizations and make working with Ruk-Com Cloud PaaS more convenient.
In this article, we will explain how to add common variables for nodes within the platform:
- Through dashboard specific variables
- Through shell to configure file
- via variables.conf file (for Java only)
Environment customization via UI
1. Hover your mouse over a node on the dashboard. Press to expand additional items and select an option.Variables

2. Within the variables frame, you can modify the list of environment variables as you want. (Use the toolbar at the top)
Note:Using Ruk-Com Cloud's Docker container allows using existing environment variables to define other things, e.g.MY$HOMEwill be changed toMY\automatically (or similar according to the variable valueHOME)

Set Environment variables via Shell Configs
You can customize variables by configuring the shell:
- ~/.bash_profileIt is performed specifically when logging in through the console.
- ~/.bashrcThis is performed for each new bash instance.
To help you maintain these files, Ruk-Com Cloud compiles config sources..bashrcWithin.bash_profile automatically This way you can specify custom variables only through the original file:
1. Creating an SSH connection to your container For example using the embedded Web SSH client:

2. Create or modify a.bashrc file within the home directory by adding custom variables in the following format:
export {var_name}= {var_value}
where
- {var_name}- Name of the variable to be specified.
- {var_value}- Value of variable

3. Each new bash instance will now receive your custom variables. To set a new device for the current session, simply refresh source with the command shown below. After that check the available variables:
source ~/.bashrc
echo $ {var_name}

Modifying Environment variables through Configuration Manager
The following basic workflow is for managing all Ruk-Com CLoud Java application servers.
1. Click the buttonConfigFor the app to hit your server to gain accessFile managementContainer

2. Once the tab is open, go to File. variable.conf Within one of the following positions:
- Tomcat,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
3. Here you can specify custom variables. (Each variable should be separated by a space or newline) orModifying Java optionsfor your application For example:
-Dvar1=value1 -Dvar2=value2
-Dmy.var3=/my/value

Tips:Alternatively, some server applications (e.g. GlassFish, Payara, WildFly) have admin panels that allow adding custom JVM options and variables:
Don't forgetSaveto save the values you set.
4.Restart Nodesof your application server to apply the changes.

5. You can call new variables through Java code using this method. System.getProperty("your_variable") to assign the specified value to the required arguments. For example:
- Stringvar1= System.getProperty("var1");
- Stringvar2= System.getProperty("var2");
- Stringvar3= System.getProperty("my.var3");
You can now modify the code in your application using these new variables.