basic API to be used in swarm mode
This commit is contained in:
@@ -126,3 +126,5 @@ USE_ANTIBOT="${USE_ANTIBOT-no}"
|
||||
ANTIBOT_RECAPTCHA_SCORE="${ANTIBOT_RECAPTCHA_SCORE-0.7}"
|
||||
ANTIBOT_SESSION_SECRET="${ANTIBOT_SESSION_SECRET-random}"
|
||||
USE_CROWDSEC="${USE_CROWDSEC-no}"
|
||||
USE_API="${USE_API-no}"
|
||||
API_URI="${API_URI-random}"
|
||||
|
||||
@@ -305,6 +305,17 @@ else
|
||||
replace_in_file "/etc/nginx/nginx.conf" "%USE_CROWDSEC%" ""
|
||||
fi
|
||||
|
||||
# API
|
||||
if [ "$USE_API" = "yes" ] ; then
|
||||
replace_in_file "/etc/nginx/nginx.conf" "%USE_API%" "include /etc/nginx/api.conf;"
|
||||
if [ "$API_URI" = "random" ] ; then
|
||||
API_URI="/$(cat /dev/urandom | tr -dc 'a-zA-Z0-9' | fold -w 32 | head -n 1)"
|
||||
fi
|
||||
replace_in_file "/usr/local/lib/lua/api.lua" "%API_URI%" "$API_URI"
|
||||
else
|
||||
replace_in_file "/etc/nginx/nginx.conf" "%USE_API%" ""
|
||||
fi
|
||||
|
||||
# create empty logs
|
||||
touch /var/log/access.log
|
||||
touch /var/log/error.log
|
||||
|
||||
Reference in New Issue
Block a user