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

46 lines
834 B
Bash
Executable File

#!/bin/sh
set -f
. /image-entry.d/00-common.envsh
[ "${NGX_STRICT_LOAD}" = 0 ] || set -e
cd "${merged_root}/"
expand_error_delim() {
IEP_TRACE=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