From 3c0a74f206fac7f6ee9c10ef0f199b6077b02c72 Mon Sep 17 00:00:00 2001 From: Konstantin Demin Date: Tue, 23 Jul 2024 00:18:54 +0300 Subject: [PATCH] minor template improvement --- angie/conf.dist/core-worker-env.conf.j2 | 24 ++++++++++++------------ 1 file changed, 12 insertions(+), 12 deletions(-) diff --git a/angie/conf.dist/core-worker-env.conf.j2 b/angie/conf.dist/core-worker-env.conf.j2 index 3dfd69b..fddbd30 100644 --- a/angie/conf.dist/core-worker-env.conf.j2 +++ b/angie/conf.dist/core-worker-env.conf.j2 @@ -5,23 +5,23 @@ {%- set c_vars = c_env | dict_keys -%} {%- set c_vars_preserve = c_env | dict_empty_keys -%} {%- set c_vars_override = c_env | dict_non_empty_keys -%} -{%- set vars_preserve = ( c_vars_preserve + ( s_vars | list_diff(c_vars) )) | sort -%} -{#- main part -#} -{%- if vars_preserve %} -## preserve - {%- for k in vars_preserve %} -env {{ k }}; - {%- endfor %} -{% endif %} +{%- set vars_preserve = ( c_vars_preserve + s_vars ) | uniq | sort -%} -{%- if c_vars_override %} +{#- main part -#} +## preserve +{%- for k in vars_preserve %} +env {{ k }}; +{%- endfor %} + +{% if c_vars_override %} ## WARNING! ## explicit environment variables are NOT implemented ## reason: envs are supported only for http_perl but not for http_js/stream_js ## solution: provide environment variables explicitly ## and then list them in "core_worker_env" key in config +## {%- for k in c_vars_override %} - {%- set v = c_env[k] -%} -# env {{ k }}={{ v.__repr__() }}; + {#- {%- set v = c_env[k] %} #} +## env {{ k }}={{ c_env[k].__repr__() }}; {%- endfor %} -{% endif %} +{%- endif %}