custom conf - init setting support

This commit is contained in:
florian 2022-07-01 11:21:44 +02:00
parent 0a1e8be71f
commit a5457a164c
2 changed files with 21 additions and 2 deletions

View File

@ -1,6 +1,10 @@
# Changelog
## v1.4.2 -
## v1.4.3 -
- Add \*_CUSTOM_CONF_\* setting to automatically add custom config files from setting value
## v1.4.2 - 2022/06/28
- Fix "too old resource version" exceptions when using k8s integration
- Fix missing bwcli command with Linux integration
@ -17,7 +21,7 @@
- Add Discord and Slack to list of official plugins
- Force NGINX version dependencies in Linux packages DEB/RPM
## v1.4.1 - 2022/16/06
## v1.4.1 - 2022/06/16
- Fix sending local IPs to BunkerNet when DISABLE_DEFAULT_SERVER=yes
- Fix certbot bug when AUTOCONF_MODE=yes

View File

@ -45,6 +45,21 @@ if [ -f /opt/bunkerweb/tmp/scheduler.pid ] ; then
fi
if [ "$SWARM_MODE" != "yes" ] && [ "$KUBERNETES_MODE" != "yes" ] && [ "$AUTOCONF_MODE" != "yes" ] ; then
# extract and drop configs
for var_name in $(compgen -v) ; do
extracted=$(echo "$var_name" | | sed -r 's/^([a-z\.\-]*)_?CUSTOM_CONF_(HTTP|DEFAULT_SERVER_HTTP|SERVER_HTTP|MODSEC|MODSEC_CRS)_(.*)$/\1 \2 \3/g')
site=$(echo "$extracted" | cut -d ' ' -f 1)
type=$(echo "$extracted" | cut -d ' ' -f 2 | tr '[:upper:]' '[:lower:]' | sed 's/_/-/')
name=$(echo "$extracted" | cut -d ' ' -f 3)
if [ "$type" = "" ] ; then
continue
fi
if [ "$site" != "" ] && [ ! -d "/data/configs/${type}/${site}" ] ; then
mkdir "/data/configs/${type}/${site}"
fi
echo "${!var_name}" > "/data/configs/${type}/${site}/${name}.conf"
done
# execute temp nginx with no server
export TEMP_NGINX="yes"
log "ENTRYPOINT" "" "Generating configuration for temp nginx ..."