Rulex Platform Variables

Variables are a very powerful feature, as they allow users to centrally control all customizations, as they are saved at a primary resource level. This aspect therefore makes it possible to edit Rulex Platform configurations in a unique place, without the need to change the hard-coded code for every single option.

They are strongly linked to the Parametric visualization of Rulex Platform options and configurations.

Warning

Variables and Parametric visualization are only available in Factory Personal and Enterprise licenses.


Variable definition

To associate/retrieve/modify any variable in any primary resource, you have to use the Variables Manager.

Before defining a variable on Rulex Platform, you need to satisfy the following prerequisites:

Prerequisites

  • you must have a primary resource selected with left-click from your Explorer pane

  • you must have modify permission on the primary resource

To open the Variables tab, follow the steps down below:

Procedure

  1. Click on your primary resource to select it.

  2. Click on the Variables tab, which is in the left-hand panel tabs of the stage window and is the second tab from the top.

The Variables tab is organized in two parts, corresponding to the two types of variables supported by the Platform:

  • Code variables: where the value of the variable is evaluated via a string of GOLD code.

  • Vault variables: where the value of the variable is retrieved at runtime from a secret located in the chosen Vault Resource.

Warning

Vault variables are only available in Factory Enterprise license.

Visualization in this panel is in read-only mode; and it was created to allow users to always visualize the values of the variables they are currently using. To change their values or their characteristics you need to open the Variables Manager by clicking on the pencil-shaped icon in the top right-hand corner of the left panel.


Variables Manager

The Variables Manager allows users to modify all the variables defined in the current primary resource.

https://cdn.rulex.ai/docs/Factory/vars_manager.webp

The panel is divided into two tabs corresponding to the two different variable types. In each part you can:

  • Add new variables by clicking on the plus button.

  • Delete existing variables, by selecting them, and then by pressing the minus button.

  • Edit the name or the value of an existing variable by interacting with the Variables Manager table (only if the variable Source is Local).

Warning

The variable name must contain only ASCII alphanumerical characters (capital or not) and no symbols other than the underscore (_).

In the Vault tab each variable must be linked to a vault resource that must be created and for which the user must have the view permission allowed.

Another characteristic of each variable is its Source; this option can take two different values: Local or Environment.

Tip

In the Variables Manager the Source property of each variable is shown by its background color: it is white if it is Local (set at primary resource level) or it has a light green background color if it is inherited from the original Environment.

The Source option takes the value Local, if the considered variable value has been defined locally in the primary resource, or Environment, if it has been inherited from the Environment. By default, environment variables always have priority over local variables, meaning that when a primary resource is created or imported if a variable with the same name of a local variable exists in the environment, the Source flag will automatically be set to the Environment value.

Environment variables are essential to automatically change the configuration when moving primary resources from one environment to another. For more information on environment variables, see page: Using Environment variables.

Note

At any time a variable can be detached from the value inherited from its environment by switching its Source flag value from Environment to Local. Please note that this procedure can only be performed on environment variables.

To manage your variables, follow these step-by-step instructions:

Procedure

  1. Select the Variables tab from the panel located at the left of the stage.

  2. Click on the pencil-shaped icon to open the Variables Manager.

  3. Manage your variables, by either:

    • Clicking on the text field you want to make changes to;

    • Clicking on the plus icon to add new variables;

    • Clicking on the minus icon to delete existing variables.

  4. Click Save to save the changes or click Discard to close the panel without applying any changes.


Sensitive Variables

Sensitive variables are a particular subtype of code variables which store their internal value in an encrypted way. They are perfect to store sensitive information such as passwords, passphrases or tokens.

Since they are a subtype they are not separated from the not sensitive ones. Your variable list can be filtered to show only sensitive entries by clicking on the eye-shaped icon located in the upper left-hand corner of the Variables Manager.

The value of a sensitive variable is only visible when it is written for the first time (by clicking on the eye-shaped icon next to the text typing form), while it is no longer retrievable once the insertion is finished and saved.

Danger

Sensitive variables values are deleted when the primary resource is exported on file or versioned. If you import or clone the just considered resource their values will be None.


Variable use

Variables are referred and used in Parametric visualization of options and configuration. To retrieve and use the value of a variable stored in a primary resource you need to write the @ symbol followed by its name.

The use of variables in options and configurations is neither related to the type of variables (Code or Vault) nor to their current Source (Local or Environment).

At runtime, when the option needs to be used, the variable itself will be evaluated and an always new value will be retrieved and used.

Tip

In Rulex Factory there is a way to overwrite at runtime some values of not sensitive code variables by using a dedicated task, the Runtime variables task.

Tip

During automated execution via Rulex Platform Command Line Interface or Rulex Platform REST API, you can overwrite certain values at runtime by using the “procvars” compute params.