{#- prologue -#} {#- NB: "TZ" is always provided by Angie itself -#} {%- set c_env = ( j2cfg.core_worker_env or [] ) | any_to_env_dict -%} {%- set c_vars = c_env | dict_keys -%} {%- set c_vars_passthrough = c_env | dict_empty_keys -%} {%- set c_vars_override = c_env | dict_non_empty_keys -%} {%- set vars_passthrough = (env_passthrough + c_vars_passthrough) | uniq | list_intersect(env | dict_keys) -%} {#- main part -#} ## preserve {%- for k in env_preserve %} env {{ k }}; {%- endfor %} ## passthrough {%- for k in vars_passthrough %} 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 }}={{ c_env[k] | ngx_esc }}; {%- endfor %} {%- endif %}