1
0
angie-conv-image/image-entry.d/73-expand-templates.sh

49 lines
892 B
Bash
Executable File

#!/bin/sh
set -f
. /image-entry.d/00-common.envsh
## Angie: unset core variable
unset ANGIE ANGIE_BPF_MAPS
[ "${NGX_STRICT_LOAD}" = 0 ] || set -e
cd "${merged_root}/"
expand_error_delim() {
IEP_DEBUG=0 log_always ' ----------------------------------- '
}
expand_error() {
[ "${expand_error_seen:-}" != 1 ] || return
expand_error_seen=1
expand_error_delim
log_always 'template expansion has failed'
if [ "${NGX_STRICT_LOAD}" = 1 ] ; then
t=15
log_always "injecting delay for $t seconds"
expand_error_delim
sleep $t
exit 1
fi
expand_error_delim
}
merge_dirs=
for n in ${NGX_DIRS_MERGE} ; do
[ -n "$n" ] || continue
[ -d "$n" ] || continue
merge_dirs="${merge_dirs} $n/"
done
expand_dir_envsubst ${merge_dirs} || expand_error
set -a
J2CFG_PATH="${merged_root}/j2cfg"
J2CFG_SEARCH_PATH="${merged_root}"
set -a
expand_dir_j2cfg ${merge_dirs} || expand_error
exit 0