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

36 lines
727 B
Bash
Raw Normal View History

2024-07-11 13:37:35 +03:00
#!/bin/sh
2024-07-16 11:33:20 +03:00
set -f
2024-07-11 13:37:35 +03:00
. /image-entry.d/00-common.envsh
2024-07-16 11:33:20 +03:00
[ "${NGX_STRICT_LOAD}" = 0 ] || set -e
export NGX_MERGED_ROOT="${merged_root}"
2024-07-16 11:33:20 +03:00
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
}
2024-07-16 02:43:08 +03:00
dirs='conf mod modules njs site snip'
[ "${NGX_PROCESS_STATIC}" = 0 ] || dirs="${dirs} static"
merge_dirs=
2024-07-16 02:43:08 +03:00
for n in ${dirs} ; do
merged_dir="${merged_root}/$n"
[ -d "${merged_dir}" ] || continue
merge_dirs="${merge_dirs} ${merged_dir}/"
2024-07-16 02:43:08 +03:00
done
2024-07-11 13:37:35 +03:00
expand_dir_envsubst ${merge_dirs} || expand_error
expand_dir_jinja ${merge_dirs} || expand_error
2024-07-11 13:37:35 +03:00
exit 0