Using Environment Variables#

Warning

This type of variable is available in the Factory Personal license with certain restrictions (i.e. Vault vars are only provided in the Enterprise license).

Environment variables are variables defined at a higher level, which are inherited by the whole set of primary resources belonging to the current environment. They allow a higher level of control and configuration, which is automatically shared with the resources within the environment and can override local setting, according to the environment properties.

Environment variables are in their use, definition, and modification exactly like general variables. Consequently, all the properties listed in the general overview also apply to environment ones.

As said in the Environment presentation overview, it is possible to build environments within environments. Therefore, it is necessary to establish a hierarchy when different environments have the same variable defined. The hierarchy structure applied to the environment variables is that any internal environment variable overrides the most general one. This procedure allows the user to create an even more precise structure when specific cases are treated as internal environments.

To open the Environment Variables panel you need to right-click on the desired environment and to select Environment Variables entry.


Environment variables panel#

The Environment variables panel allows the editing of all environment variables defined in the current environment.

The panel is divided into two tabs, which correspond to the two different variable types, Code or Vault. In each tab 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 Environment variables table.

Warning

The variable name can only contain ASCII alphanumerical characters (capital or not) and the underscore (_) symbol.

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

Editing, creating and deleting environment variables has an immediate impact on the variables’ Source options for any primary resource contained in the environment itself, or in any environment within the environment (for a definition of the Source property please see page: Rulex Platform Variables).

Down below there is a list of what happens to the Source value when a user creates, deletes, edits or renames an environment variable:

  • The creation of an environment variable adds the new variable within any resource, if it doesn’t exist. Alternatively, this operation changes the existing variable with the same name, so that the Source value switches to Environment.

  • The deletion of an environment variable changes all the variables with the same name, so that Source value switches to Local in any internal primary resource.

  • The editing of an environment variable modifies all the variables with the same name, which have as Source value Environment, leaving the others unchanged.

  • The renaming of an environment variable should be interpreted as a deletion/creation operation in terms of its effects on internal resources.

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

Procedure

  1. Open the Explorer.

  2. Browse to the chosen environment and right-click on it. Alternatively, you can click on the three-dotted button.

  3. Select the Environment Variables entry.

  4. Select whether you want to add Code variables or Vault variables by clicking on the corresponding tab.

  5. Manage environment variables by either:

    • Clicking on the variables you want to modify;

    • Clicking on the plus button to add new variables, then from the Add code variables window choose from the Number of variables spin box how many environment variables you want to create and select the Sensitive checkbox if you want them to be sensitive;

    • Clicking on the minus icon to delete variables.

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

Imagine a scenario in which the environment named DEV contains a primary resource of type flow with the following variables:

Example

  • today - currDate()

  • rules - ' OR '

The variables above have a Local source, as they have been set within the flow.

A new variable needs to be added, which must be common to all the primary resources, so add it to the Environment variables panel.

Open the Explorer and browse to the environment where the flow belongs to. Right-click on it and select Environment Variables.

Add a new variable by clicking on the plus button. Define it as follows:

  • Name - department

  • Value - ‘Marketing’

Then, click Save.

Go back to the flow and open the Variables tab located at the left of the stage: as you can see, the variable defined at environment level has a light green background and if you open the Variables Manager, the variable Source flag is set to Environment.