Mercurial > piecrust2
changeset 1129:957f7c972715
chef: Support special tokens in the `chef/env` setting.
author | Ludovic Chabant <ludovic@chabant.com> |
---|---|
date | Wed, 28 Feb 2018 20:43:52 -0800 |
parents | 6ab1299c1058 |
children | 71627dd7d2f1 |
files | piecrust/main.py |
diffstat | 1 files changed, 9 insertions(+), 2 deletions(-) [+] |
line wrap: on
line diff
--- a/piecrust/main.py Wed Feb 28 20:20:48 2018 -0800 +++ b/piecrust/main.py Wed Feb 28 20:43:52 2018 -0800 @@ -246,7 +246,12 @@ return cache_key -def _setup_app_environment(env): +def _setup_app_environment(app, env): + from piecrust.uriutil import multi_replace + + tokens = { + '%root_dir%': app.root_dir} + for k, v in env.items(): varname = k append = False @@ -257,6 +262,8 @@ varname = k[:-1] append = True + v = multi_replace(v, tokens) + if append: logger.debug("Env: $%s += %s" % (varname, v)) os.environ[varname] += v @@ -337,7 +344,7 @@ # Do any custom setup the user wants. custom_env = app.config.get('chef/env') if custom_env: - _setup_app_environment(custom_env) + _setup_app_environment(app, custom_env) # Add some timing information. if app.env: