Constants

You can define constants in your activestate.yaml file and reuse them throughout the file. Constants are defined in a constants section using name/value pairs:

constants:
  - name: LOCATION
    value: World

You can use the constants you define in other constants, scripts, events, and other configuration fields. The following example defines the same LOCATION constant, and references it in the subsequent entry as $constants.LOCATION. Constants are referenced this way wherever you use them in your activestate.yaml file. Constant names are not case-sensitive.

constants:
  - name: LOCATION
    value: World
  - name: HELLO
    value: Hello $constants.LOCATION

Using configuration values as variables is supported for many different fields, not just constants. You can also wrap your variables in brackets in case you’re using them in more advanced scenarios where the variable parser might otherwise get confused, so for example you could use your constant in the following way:

constants:
  - name: LOCATION
    value: World
  - name: HELLO
    value: Hello ${constants.LOCATION}