1
0
angie-conv-image/image-entry.d/53-expand-templates.sh
2024-07-17 12:16:51 +03:00

36 lines
727 B
Bash
Executable File

#!/bin/sh
set -f
. /image-entry.d/00-common.envsh
[ "${NGX_STRICT_LOAD}" = 0 ] || set -e
export NGX_MERGED_ROOT="${merged_root}"
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"
merge_dirs=
for n in ${dirs} ; do
merged_dir="${merged_root}/$n"
[ -d "${merged_dir}" ] || continue
merge_dirs="${merge_dirs} ${merged_dir}/"
done
expand_dir_envsubst ${merge_dirs} || expand_error
expand_dir_jinja ${merge_dirs} || expand_error
exit 0