1
0

minor template improvement

This commit is contained in:
Konstantin Demin 2024-07-23 00:18:54 +03:00
parent a69d6c2920
commit 3c0a74f206
Signed by: krd
GPG Key ID: 4D56F87A8BA65FD0

View File

@ -5,23 +5,23 @@
{%- set c_vars = c_env | dict_keys -%} {%- set c_vars = c_env | dict_keys -%}
{%- set c_vars_preserve = c_env | dict_empty_keys -%} {%- set c_vars_preserve = c_env | dict_empty_keys -%}
{%- set c_vars_override = c_env | dict_non_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 -%} {%- set vars_preserve = ( c_vars_preserve + s_vars ) | uniq | sort -%}
{#- main part -#}
{%- if vars_preserve %}
## preserve
{%- for k in vars_preserve %}
env {{ k }};
{%- endfor %}
{% endif %}
{%- if c_vars_override %} {#- main part -#}
## preserve
{%- for k in vars_preserve %}
env {{ k }};
{%- endfor %}
{% if c_vars_override %}
## WARNING! ## WARNING!
## explicit environment variables are NOT implemented ## explicit environment variables are NOT implemented
## reason: envs are supported only for http_perl but not for http_js/stream_js ## reason: envs are supported only for http_perl but not for http_js/stream_js
## solution: provide environment variables explicitly ## solution: provide environment variables explicitly
## and then list them in "core_worker_env" key in config ## and then list them in "core_worker_env" key in config
##
{%- for k in c_vars_override %} {%- for k in c_vars_override %}
{%- set v = c_env[k] -%} {#- {%- set v = c_env[k] %} #}
# env {{ k }}={{ v.__repr__() }}; ## env {{ k }}={{ c_env[k].__repr__() }};
{%- endfor %} {%- endfor %}
{% endif %} {%- endif %}