File tree Expand file tree Collapse file tree 1 file changed +33
-0
lines changed Expand file tree Collapse file tree 1 file changed +33
-0
lines changed Original file line number Diff line number Diff line change 1+ #! /command/with-contenv bash
2+
3+ set -e # Exit immediately if a command exits with a non-zero status.
4+
5+ mkdir -p /config/crowdsec/templates
6+ echo " Deploy Crowdsec Openresty Bouncer.."
7+ sed -i ' s|/defaults/crowdsec|/config/crowdsec|' /etc/nginx/conf.d/crowdsec_openresty.conf
8+
9+ if [ -f /data/crowdsec/crowdsec-openresty-bouncer.conf ]; then
10+ echo " Patch crowdsec-openresty-bouncer.conf .."
11+ sed " s/=.*//g" /config/crowdsec/crowdsec-openresty-bouncer.conf > /tmp/crowdsec.conf.raw
12+ sed " s/=.*//g" /defaults/crowdsec/crowdsec-openresty-bouncer.conf > /tmp/crowdsec-openresty-bouncer.conf.raw
13+ if grep -vf /tmp/crowdsec.conf.raw /tmp/crowdsec-openresty-bouncer.conf.raw ; then
14+ grep -vf /tmp/crowdsec.conf.raw /tmp/crowdsec-openresty-bouncer.conf.raw > /tmp/config.newvals
15+ cp /config/crowdsec/crowdsec-openresty-bouncer.conf /config/crowdsec/crowdsec-openresty-bouncer.conf.bak
16+ grep -f /tmp/config.newvals /defaults/crowdsec/crowdsec-openresty-bouncer.conf >> /config/crowdsec/crowdsec-openresty-bouncer.conf
17+ fi
18+ else
19+ echo " Deploy new crowdsec-openresty-bouncer.conf .."
20+ cp /defaults/crowdsec/crowdsec-openresty-bouncer.conf /config/crowdsec/crowdsec-openresty-bouncer.conf
21+ fi
22+ # Make sure the config location is where we get the config from instead of /default/
23+ sed -i ' s|/defaults/crowdsec|/config/crowdsec|' /config/crowdsec/crowdsec-openresty-bouncer.conf
24+ echo " Deploy Crowdsec Templates .."
25+ # Make sure we only copy files that don't exist in /data/crowdsec.
26+ cd /defaults/crowdsec/templates/
27+ for file in * .html
28+ do
29+ if [ ! -e " /config/crowdsec/templates/${file} " ]
30+ then
31+ cp -r " /defaults/crowdsec/templates/${file} " " /config/crowdsec/templates/"
32+ fi
33+ done
You can’t perform that action at this time.
0 commit comments