Skip to content

Commit b987850

Browse files
committed
Add extra check for environment variable
Fix rm command for folders.
1 parent 7793f92 commit b987850

File tree

1 file changed

+8
-2
lines changed

1 file changed

+8
-2
lines changed

scripts/install-crowdsec_openresty_bouncer

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,9 +4,15 @@ BLUE='\E[1;34m'
44
CYAN='\E[1;36m'
55
YELLOW='\E[1;33m'
66
GREEN='\E[1;32m'
7+
RED='\E[1;31m'
78
RESET='\E[0m'
89

9-
echo -e "${BLUE}${CYAN}Installing Crowdsec OpenResty Bouncer ${YELLOW}${CROWDSEC_OPENRESTY_BOUNCER_VERSION}...${RESET}"
10+
echo -e "${BLUE}${CYAN}Installing Crowdsec OpenResty Bouncer ${YELLOW}${CROWDSEC_OPENRESTY_BOUNCER_VERSION:-}...${RESET}"
11+
12+
if [ "${CROWDSEC_OPENRESTY_BOUNCER_VERSION:-}" = "" ]; then
13+
echo -e "${RED}❯ ERROR: CROWDSEC_OPENRESTY_BOUNCER_VERSION environment variable is not set!${RESET}"
14+
exit 1
15+
fi
1016

1117
cd /tmp
1218
wget "https://github.com/crowdsecurity/cs-openresty-bouncer/releases/download/v${CROWDSEC_OPENRESTY_BOUNCER_VERSION}/crowdsec-openresty-bouncer.tgz"
@@ -17,6 +23,6 @@ cd /tmp/crowdsec
1723

1824
bash ./install.sh --NGINX_CONF_DIR=/etc/nginx/conf.d --LIB_PATH=/etc/nginx/lualib --CONFIG_PATH=/defaults/crowdsec --DATA_PATH=/defaults/crowdsec --docker
1925
sed -i 's|ENABLED=.*|ENABLED=false|' /defaults/crowdsec/crowdsec-openresty-bouncer.conf
20-
rm /tmp/crowdsec
26+
rm -rf /tmp/crowdsec
2127

2228
echo -e "${BLUE}${GREEN}OpenResty plugins install completed${RESET}"

0 commit comments

Comments
 (0)