Skip to content

Vars (v0.4.0)

J-Loudet edited this page Dec 30, 2022 · 1 revision

Vars

Vars are a convenient way to do string replacement in your descriptor files.

For instance, let us assume that you need to specify the path of a directory at several places in the same descriptor file. Associating a var to this full path would allow you to only repeat the var.

How to use

Declaration

Each var must be declared in a vars section of your descriptor. The underlying structure is a hash map so each entry should not be prefixed by a dash ("-", as that would turn it into a list).

vars:
    FOO: foo/bar/baz
    BAR: bar foo baz

This declaration is supported in all descriptors.

Usage

To use a var two conditions must be met:

  • surround the entire value with double quotes,
  • surround the var with two consecutive pairs of curly braces.
vars:
  FOO: foo/bar/baz
  
configuration:
  base_path: "{{ FOO }}/root-directory"

⚠️ Each var is local to the descriptor in which it is declared. To use the same var in different files, its declaration must be repeated in each descriptor.

Clone this wiki locally