Given a Docker Link environment variable value, format it into something else.
This first parses a Docker Link value like this:
DB_PORT=tcp://172.17.0.5:5432
Into a dict:
{
'proto': 'tcp',
'addr': '172.17.0.5',
'port': '5432'
}
And then uses format
to format it, where the default format is '{addr}:{port}'.
More info here: Docker Links
Use an environment variable's value inside your template.
This filter is available even when your data source is something other that the environment.
Example:
User: {{ user_login }}
Pass: {{ "USER_PASSWORD"|env }}
You can provide the default value:
Pass: {{ "USER_PASSWORD"|env("-none-") }}
For your convenience, it's also available as a function:
User: {{ user_login }}
Pass: {{ env("USER_PASSWORD") }}
Notice that there must be quotes around the environment variable name