1
0
angie-conv-image/image-entry.d/41-stream-modules.envsh

40 lines
832 B
Bash
Executable File

#!/bin/sh
if [ "${NGX_STREAM}" = 1 ] ; then
unset stream_modules stream_snippets
stream_modules=
stream_snippets="${NGX_STREAM_SNIPPETS:-}"
## filter out builtin stream modules
unset i
for i in ${NGX_STREAM_MODULES:-} ; do
[ -n "$i" ] || continue
if is_builtin_module stream "$i" ; then
log "$i is builtin module, moving to snippets"
stream_snippets="${stream_snippets}${stream_snippets:+ }$i"
continue
fi
## naive deduplication
case " ${stream_modules} " in
*" $i "* )
log "$i is already specified"
continue
;;
esac
stream_modules="${stream_modules}${stream_modules:+ }$i"
done
unset i
stream_snippets=$(sort_dedup_list "${stream_snippets}")
set -a
NGX_STREAM_MODULES="${stream_modules}"
NGX_STREAM_SNIPPETS="${stream_snippets}"
set +a
unset stream_modules stream_snippets
fi