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

49 lines
892 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
## Angie: unset core variable
unset ANGIE ANGIE_BPF_MAPS
2024-07-16 11:33:20 +03:00
[ "${NGX_STRICT_LOAD}" = 0 ] || set -e
2024-07-20 16:35:39 +03:00
cd "${merged_root}/"
2024-07-20 16:35:39 +03:00
expand_error_delim() {
IEP_DEBUG=0 log_always ' ----------------------------------- '
2024-07-20 16:35:39 +03:00
}
2024-07-16 11:33:20 +03:00
expand_error() {
2024-07-20 16:35:39 +03:00
[ "${expand_error_seen:-}" != 1 ] || return
2024-07-16 11:33:20 +03:00
expand_error_seen=1
2024-07-20 16:35:39 +03:00
expand_error_delim
log_always 'template expansion has failed'
2024-07-16 11:33:20 +03:00
if [ "${NGX_STRICT_LOAD}" = 1 ] ; then
2024-07-20 16:35:39 +03:00
t=15
2024-07-16 11:33:20 +03:00
log_always "injecting delay for $t seconds"
2024-07-20 16:35:39 +03:00
expand_error_delim
2024-07-16 11:33:20 +03:00
sleep $t
exit 1
fi
2024-07-20 16:35:39 +03:00
expand_error_delim
2024-07-16 11:33:20 +03:00
}
merge_dirs=
2024-07-20 16:35:39 +03:00
for n in ${NGX_DIRS_MERGE} ; do
[ -n "$n" ] || continue
[ -d "$n" ] || continue
2024-07-16 02:43:08 +03:00
2024-07-20 16:35:39 +03:00
merge_dirs="${merge_dirs} $n/"
2024-07-16 02:43:08 +03:00
done
2024-07-11 13:37:35 +03:00
expand_dir_envsubst ${merge_dirs} || expand_error
2024-07-20 16:35:39 +03:00
set -a
J2CFG_PATH="${merged_root}/j2cfg"
J2CFG_SEARCH_PATH="${merged_root}"
set -a
expand_dir_j2cfg ${merge_dirs} || expand_error
2024-07-11 13:37:35 +03:00
exit 0