Environment variables for node operation

1. Predefined environment variables

A Bash component has optional properties for users to input. These properties will be available in the configure script as the environment variables:

  • COMPONENT_VERSION: to input a version number (e.g., 1.0).
  • PROTOCOL: to input a protocol (e.g., tcp).
  • PORT: to input a port (e.g., 27017).
  • NODE: set to the node name of the component (e.g., Bash_1).
  • HOST: set to the name of the compute node, which the Bash component is hosted on (e.g., Compute_1).
  • ip_address: set to the runtime IP address of the compute node, which hosts this component.

2. User-defined environment variables

Users can define custom environment variables using the env property.

Fig. Bash component properties

The env property is a map of string values. In this example, we add an entry with key FOO and value bar:

Fig. Bash component properties

Then we can access the variable FOO in the configure script of the Bash component as follows:

# This will print out: Hello bar
echo "Hello $FOO"