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

31 lines
638 B
Bash
Executable File

#!/bin/sh
set -f
. /image-entry.d/00-common.envsh
[ "${NGX_STRICT_LOAD}" = 0 ] || set -e
expand_error() {
[ "${expand_error_seen:-}" = 1 ] || log_always 'template expansion has failed'
expand_error_seen=1
if [ "${NGX_STRICT_LOAD}" = 1 ] ; then
t=10
log_always "injecting delay for $t seconds"
sleep $t
exit 1
fi
}
dirs='conf mod modules njs site snip'
[ "${NGX_PROCESS_STATIC}" = 0 ] || dirs="${dirs} static"
for n in ${dirs} ; do
merged_dir="${merged_root}/$n"
[ -d "${merged_dir}" ] || continue
expand_dir_envsubst "${merged_dir}/" || expand_error
expand_dir_jinja "${merged_dir}/" || expand_error
done
exit 0