1
0
angie-conv-image/image-entry.d/01-defaults.envsh

57 lines
1.4 KiB
Bash
Executable File

#!/bin/sh
## NB: NGX_DEBUG is set via image build script
set -a
NGX_STRICT_LOAD=$(gobool_to_int "${NGX_STRICT_LOAD:-1}" 1)
NGX_PROCESS_STATIC=$(gobool_to_int "${NGX_PROCESS_STATIC:-0}" 0)
NGX_HTTP=$(gobool_to_int "${NGX_HTTP:-1}" 1)
NGX_MAIL=$(gobool_to_int "${NGX_MAIL:-0}" 0)
NGX_STREAM=$(gobool_to_int "${NGX_STREAM:-0}" 0)
set +a
if [ "${NGX_HTTP}${NGX_MAIL}${NGX_STREAM}" = '000' ] ; then
log_always '======================================'
log_always 'WARNING!'
log_always 'Angie is almost completely TURNED OFF'
log_always '======================================'
fi
unset default_dirs_merge default_dirs_link
default_dirs_merge='conf j2cfg mod modules site snip'
default_dirs_link=''
if [ "${NGX_PROCESS_STATIC}" = 1 ] ; then
NGX_DIRS_MERGE="${NGX_DIRS_MERGE:-} static"
else
NGX_DIRS_LINK="${NGX_DIRS_LINK:-} static"
fi
set -a
NGX_DIRS_MERGE=$(sort_dedup_list "${default_dirs_merge} ${NGX_DIRS_MERGE:-}")
NGX_DIRS_LINK=$(sort_dedup_list "${default_dirs_link} ${NGX_DIRS_LINK:-}")
set +a
unset default_dirs_merge default_dirs_link
unset i dirs_link
dirs_link=
for i in ${NGX_DIRS_LINK:-} ; do
[ -n "$i" ] || continue
## naive deduplication
case " ${NGX_DIRS_MERGE} " in
*" $i "* )
log "$i is already specified in NGX_DIRS_MERGE - removing from NGX_DIRS_LINK"
continue
;;
esac
dirs_link="${dirs_link}${dirs_link:+ }$i"
done
unset i
export NGX_DIRS_LINK="${dirs_link}"
unset dirs_link