1
0

Compare commits

..

No commits in common. "3d2defc08606726bd28ef5e5aae14bea732c9f00" and "6b13a28e528c2eb238f7f403691ffb91d94cad0e" have entirely different histories.

22 changed files with 40 additions and 103 deletions

View File

@ -2,7 +2,7 @@
set -ef set -ef
cd "$(dirname "$0")/.." cd "$(dirname "$0")/.."
IMAGE_VERSION="${IMAGE_VERSION:-v0.0.7}" IMAGE_VERSION="${IMAGE_VERSION:-v0.0.6}"
set -a set -a
BUILDAH_FORMAT="${BUILDAH_FORMAT:-docker}" BUILDAH_FORMAT="${BUILDAH_FORMAT:-docker}"

View File

@ -2,7 +2,7 @@
set -ef set -ef
cd "$(dirname "$0")/.." cd "$(dirname "$0")/.."
IMAGE_VERSION="${IMAGE_VERSION:-v0.0.7}" IMAGE_VERSION="${IMAGE_VERSION:-v0.0.6}"
set -a set -a
BUILDAH_FORMAT="${BUILDAH_FORMAT:-docker}" BUILDAH_FORMAT="${BUILDAH_FORMAT:-docker}"

View File

@ -2,7 +2,7 @@
set -ef set -ef
cd "$(dirname "$0")/.." cd "$(dirname "$0")/.."
IMAGE_VERSION="${IMAGE_VERSION:-v0.0.7}" IMAGE_VERSION="${IMAGE_VERSION:-v0.0.6}"
set -a set -a
BUILDAH_FORMAT="${BUILDAH_FORMAT:-docker}" BUILDAH_FORMAT="${BUILDAH_FORMAT:-docker}"

View File

@ -1,4 +1,4 @@
FROM docker.io/rockdrilla/angie-conv:v0.0.7 FROM docker.io/rockdrilla/angie-conv:v0.0.6
SHELL [ "/bin/sh", "-ec" ] SHELL [ "/bin/sh", "-ec" ]
COPY /site/ /etc/angie/site/ COPY /site/ /etc/angie/site/

View File

@ -4,7 +4,7 @@ services:
angie-conv-example-basic: angie-conv-example-basic:
container_name: angie-conv-example-basic container_name: angie-conv-example-basic
image: docker.io/rockdrilla/angie-conv:v0.0.7 image: docker.io/rockdrilla/angie-conv:v0.0.6
environment: environment:
NGX_HTTP_NO_PROXY: 1 NGX_HTTP_NO_PROXY: 1
ports: ports:

View File

@ -58,7 +58,7 @@ services:
my-cache: my-cache:
container_name: my-cache container_name: my-cache
image: docker.io/rockdrilla/angie-conv:v0.0.7 image: docker.io/rockdrilla/angie-conv:v0.0.6
restart: always restart: always
privileged: true privileged: true
stop_grace_period: 15s stop_grace_period: 15s

View File

@ -4,7 +4,7 @@ services:
my-cache: my-cache:
container_name: my-cache container_name: my-cache
image: docker.io/rockdrilla/angie-conv:v0.0.7 image: docker.io/rockdrilla/angie-conv:v0.0.6
restart: always restart: always
privileged: true privileged: true
stop_grace_period: 15s stop_grace_period: 15s

View File

@ -1,4 +1,4 @@
FROM docker.io/rockdrilla/angie-conv:v0.0.7 FROM docker.io/rockdrilla/angie-conv:v0.0.6
SHELL [ "/bin/sh", "-ec" ] SHELL [ "/bin/sh", "-ec" ]
COPY /j2cfg/ /etc/angie/j2cfg/ COPY /j2cfg/ /etc/angie/j2cfg/

View File

@ -4,7 +4,7 @@ services:
angie-conv-example-cfg-override: angie-conv-example-cfg-override:
container_name: angie-conv-example-cfg-override container_name: angie-conv-example-cfg-override
image: docker.io/rockdrilla/angie-conv:v0.0.7 image: docker.io/rockdrilla/angie-conv:v0.0.6
environment: environment:
NGX_HTTP_MODULES: 'gzip brotli zstd' NGX_HTTP_MODULES: 'gzip brotli zstd'
ports: ports:

View File

@ -1,4 +1,4 @@
FROM docker.io/rockdrilla/angie-conv:v0.0.7 FROM docker.io/rockdrilla/angie-conv:v0.0.6
SHELL [ "/bin/sh", "-ec" ] SHELL [ "/bin/sh", "-ec" ]
COPY /site/ /etc/angie/site/ COPY /site/ /etc/angie/site/

View File

@ -3,7 +3,7 @@
Dockerfile: Dockerfile:
```dockerfile ```dockerfile
FROM docker.io/rockdrilla/angie-conv:v0.0.7 FROM docker.io/rockdrilla/angie-conv:v0.0.6
COPY /site/ /etc/angie/site/ COPY /site/ /etc/angie/site/

View File

@ -1,4 +1,4 @@
FROM docker.io/rockdrilla/angie-conv:v0.0.7 FROM docker.io/rockdrilla/angie-conv:v0.0.6
SHELL [ "/bin/sh", "-ec" ] SHELL [ "/bin/sh", "-ec" ]
COPY /site/ /etc/angie/site/ COPY /site/ /etc/angie/site/

View File

@ -3,7 +3,7 @@
Dockerfile: Dockerfile:
```dockerfile ```dockerfile
FROM docker.io/rockdrilla/angie-conv:v0.0.7 FROM docker.io/rockdrilla/angie-conv:v0.0.6
COPY /site/ /etc/angie/site/ COPY /site/ /etc/angie/site/

View File

@ -1,4 +1,4 @@
FROM docker.io/rockdrilla/angie-conv:v0.0.7 FROM docker.io/rockdrilla/angie-conv:v0.0.6
SHELL [ "/bin/sh", "-ec" ] SHELL [ "/bin/sh", "-ec" ]
COPY /site/ /etc/angie/site/ COPY /site/ /etc/angie/site/

View File

@ -4,7 +4,7 @@ services:
angie-conv-example-ssl: angie-conv-example-ssl:
container_name: angie-conv-example-ssl container_name: angie-conv-example-ssl
image: docker.io/rockdrilla/angie-conv:v0.0.7 image: docker.io/rockdrilla/angie-conv:v0.0.6
environment: environment:
NGX_HTTP_NO_PROXY: 1 NGX_HTTP_NO_PROXY: 1
NGX_HTTP_CONFLOAD: 'ssl v2' NGX_HTTP_CONFLOAD: 'ssl v2'

View File

@ -1,4 +1,4 @@
FROM docker.io/rockdrilla/angie-conv:v0.0.7 FROM docker.io/rockdrilla/angie-conv:v0.0.6
SHELL [ "/bin/sh", "-ec" ] SHELL [ "/bin/sh", "-ec" ]
COPY /site/ /etc/angie/site/ COPY /site/ /etc/angie/site/

View File

@ -4,7 +4,7 @@ services:
angie-conv-example-static-template: angie-conv-example-static-template:
container_name: angie-conv-example-static-template container_name: angie-conv-example-static-template
image: docker.io/rockdrilla/angie-conv:v0.0.7 image: docker.io/rockdrilla/angie-conv:v0.0.6
environment: environment:
NGX_HTTP_NO_PROXY: 1 NGX_HTTP_NO_PROXY: 1
NGX_PROCESS_STATIC: 1 NGX_PROCESS_STATIC: 1

View File

@ -128,40 +128,29 @@ expand_dir_envsubst() {
__template_list=$(mktemp) || return __template_list=$(mktemp) || return
find "$@" -follow -name '*.in' -type f \ find "$@" -follow -type f -name '*.in' \
| {
if [ -n "${NGX_TEMPLATE_EXCLUDE_REGEX:-}" ] ; then
grep -Ev -e "${NGX_TEMPLATE_EXCLUDE_REGEX}"
elif [ -n "${NGX_TEMPLATE_INCLUDE_REGEX:-}" ] ; then
grep -E -e "${NGX_TEMPLATE_INCLUDE_REGEX}"
else
cat
fi
} \
| sort -uV > "${__template_list}" | sort -uV > "${__template_list}"
__ret=0 __have_args="${ENVSUBST_ARGS:+1}"
if [ -s "${__template_list}" ] ; then if [ -z "${__have_args}" ] ; then
__have_args="${ENVSUBST_ARGS:+1}" ## optimize envsubst.sh invocation by caching argument list
if [ -z "${__have_args}" ] ; then ## ref: envsubst.sh
## optimize envsubst.sh invocation by caching argument list ENVSUBST_ARGS=$(mktemp) || return
## ref: envsubst.sh envsubst-args.sh > "${ENVSUBST_ARGS}"
ENVSUBST_ARGS=$(mktemp) || return export ENVSUBST_ARGS
envsubst-args.sh > "${ENVSUBST_ARGS}"
export ENVSUBST_ARGS
fi
while read -r __orig_file ; do
[ -n "${__orig_file}" ] || continue
expand_file_envsubst "${__orig_file}" || __ret=1
done < "${__template_list}"
if [ -z "${__have_args}" ] ; then
rm -f "${ENVSUBST_ARGS}" ; unset ENVSUBST_ARGS
fi
unset __have_args
fi fi
__ret=0
while read -r __orig_file ; do
[ -n "${__orig_file}" ] || continue
expand_file_envsubst "${__orig_file}" || __ret=1
done < "${__template_list}"
if [ -z "${__have_args}" ] ; then
rm -f "${ENVSUBST_ARGS}" ; unset ENVSUBST_ARGS
fi
unset __have_args
rm -f "${__template_list}" ; unset __template_list rm -f "${__template_list}" ; unset __template_list
return ${__ret} return ${__ret}
@ -172,16 +161,7 @@ expand_dir_j2cfg() {
__template_list=$(mktemp) || return __template_list=$(mktemp) || return
find "$@" -follow -name '*.j2' -type f -printf '%p\0' \ find "$@" -follow -type f -name '*.j2' -printf '%p\0' \
| {
if [ -n "${NGX_TEMPLATE_EXCLUDE_REGEX:-}" ] ; then
grep -zEv -e "${NGX_TEMPLATE_EXCLUDE_REGEX}"
elif [ -n "${NGX_TEMPLATE_INCLUDE_REGEX:-}" ] ; then
grep -zE -e "${NGX_TEMPLATE_INCLUDE_REGEX}"
else
cat
fi
} \
| sort -zuV > "${__template_list}" | sort -zuV > "${__template_list}"
__ret=0 __ret=0

View File

@ -44,10 +44,6 @@ for i in ${NGX_DIRS_MERGE:-} ; do
log_always "NGX_DIRS_MERGE: dir '$i' is not legal, skipping" log_always "NGX_DIRS_MERGE: dir '$i' is not legal, skipping"
continue continue
;; ;;
j2cfg | j2cfg/* )
log_always "NGX_DIRS_MERGE: '$i' is reserved for internal use, skipping"
continue
;;
esac esac
dirs=$(append_list "${dirs}" "$i") dirs=$(append_list "${dirs}" "$i")
@ -63,10 +59,6 @@ for i in ${NGX_DIRS_LINK:-} ; do
log_always "NGX_DIRS_LINK: dir '$i' is not legal, skipping" log_always "NGX_DIRS_LINK: dir '$i' is not legal, skipping"
continue continue
;; ;;
j2cfg | j2cfg/* )
log_always "NGX_DIRS_MERGE: '$i' is reserved for internal use, skipping"
continue
;;
esac esac
if list_have_item "${NGX_DIRS_MERGE}" "$i" ; then if list_have_item "${NGX_DIRS_MERGE}" "$i" ; then

View File

@ -38,13 +38,10 @@ for n in ${NGX_DIRS_MERGE} ; do
done done
set -a set -a
ENVSUBST_ARGS="${volume_root}/diag.envsubst.txt"
J2CFG_PATH="${merged_root}/j2cfg" J2CFG_PATH="${merged_root}/j2cfg"
J2CFG_SEARCH_PATH="${merged_root}" J2CFG_SEARCH_PATH="${merged_root}"
set +a set +a
envsubst-args.sh > "${ENVSUBST_ARGS}"
## expand j2cfg templates first ## expand j2cfg templates first
expand_dir_envsubst j2cfg/ || expand_error expand_dir_envsubst j2cfg/ || expand_error
@ -63,29 +60,4 @@ export J2CFG_CONFIG="${j2cfg_dump}"
expand_dir_j2cfg ${merge_dirs} || expand_error expand_dir_j2cfg ${merge_dirs} || expand_error
## remove template sources in order to avoid leaking sensitive data
if [ "${NGX_PROCESS_STATIC}" = 1 ] ; then
__template_list=$(mktemp)
find static/ -follow -type f -printf '%p\0' \
| grep -zE '\.(in|j2)$' \
| {
if [ -n "${NGX_TEMPLATE_EXCLUDE_REGEX:-}" ] ; then
grep -zEv -e "${NGX_TEMPLATE_EXCLUDE_REGEX}"
elif [ -n "${NGX_TEMPLATE_INCLUDE_REGEX:-}" ] ; then
grep -zE -e "${NGX_TEMPLATE_INCLUDE_REGEX}"
else
cat
fi
} \
| sort -zuV > "${__template_list}"
if [ -s "${__template_list}" ] ; then
xargs -0r -n 1000 -a "${__template_list}" \
rm -fv < /dev/null
fi
rm -f "${__template_list}" ; unset __template_list
fi
exit 0 exit 0

View File

@ -29,11 +29,8 @@ J2CFG_JINJA_EXTENSIONS = [
] ]
J2CFG_BANNED_ENVS = [ J2CFG_BANNED_ENVS = [
r'__IEP_', r'IEP_', r'ANGIE(=|$)',
r'NGX_TEMPLATE_(EX|IN)CLUDE', r'ANGIE_BPF_MAPS(=|$)'
r'ENVSUBST_',
r'J2CFG_',
r'ANGIE(|_BPF_MAPS)(=|$)',
] ]
J2CFG_PRESERVE_ENVS = [ J2CFG_PRESERVE_ENVS = [

View File

@ -3,12 +3,8 @@ set -f
sed -znE '/^([^=]+)=.*$/s,,\1,p' /proc/$$/environ \ sed -znE '/^([^=]+)=.*$/s,,\1,p' /proc/$$/environ \
| sed -zE \ | sed -zE \
-e '/^_$/d' \ -e '/^_$/d;/^ENVSUBST_/d;' \
-e '/^__IEP_/d;/^IEP_$/d' \ -e '/^__IEP_/d;/^IEP_$/d' \
-e '/^NGX_TEMPLATE_(EX|IN)CLUDE/d' \
-e '/^ENVSUBST_/d' \
-e '/^J2CFG_/d' \
-e '/^ANGIE(|_BPF_MAPS)$/d' \
| { | {
if [ -n "${ENVSUBST_EXCLUDE_REGEX:-}" ] ; then if [ -n "${ENVSUBST_EXCLUDE_REGEX:-}" ] ; then
grep -zEv -e "${ENVSUBST_EXCLUDE_REGEX}" grep -zEv -e "${ENVSUBST_EXCLUDE_REGEX}"