Substitutions

Configuration files (cfg.yml, entities, values) may contain placeholders that are replaced at runtime by variables from the environment or other sources.

Syntax

Substitution


connectionInfo:
  host: ${db.host}

Substitution with default value


connectionInfo:
  host: ${db.host:-localhost}

Substitutions in values

Substitution values can contain placeholders themselves, these will also be replaced:


connectionInfo:
  host: ${db.host:-localhost:${db.port:-5432}}

Sources

Environment variables

Environment variables are the primary source for substitutions. The placeholder name is converted to uppercase and dots are replaced by underscores. So the placeholder db.host in the examples above would be replaced by the value of the environment variable DB_HOST.

cfg.yml

A secondary source for substitutions are cfg.yml files. These substitutions are only applied to entities and values. The values are defined under the substitutions key as a nested object structure. So a value for the placeholder db.host would be defined like this:


substitutions:
  db:
    host: other:5433