diff --git a/entrypoint/global-config.sh b/entrypoint/global-config.sh index ce9ff9d..3827044 100644 --- a/entrypoint/global-config.sh +++ b/entrypoint/global-config.sh @@ -220,8 +220,6 @@ if [ "$USE_API" = "yes" ] ; then API_URI="/$(cat /dev/urandom | tr -dc 'a-zA-Z0-9' | fold -w 32 | head -n 1)" echo "[*] Generated API URI : $API_URI" fi - list=$(spaces_to_lua "$API_WHITELIST_IP") - replace_in_file "/usr/local/lib/lua/api.lua" "%API_WHITELIST_IP%" "$list" else replace_in_file "/etc/nginx/nginx.conf" "%USE_API%" "" fi diff --git a/entrypoint/lua.sh b/entrypoint/lua.sh index 182b788..64ba169 100644 --- a/entrypoint/lua.sh +++ b/entrypoint/lua.sh @@ -38,3 +38,9 @@ if [ "$(has_value USE_CROWDSEC yes)" != "" ] ; then replace_in_file "/usr/local/lib/lua/crowdsec/crowdsec.conf" "%CROWDSEC_HOST%" "$CROWDSEC_HOST" replace_in_file "/usr/local/lib/lua/crowdsec/crowdsec.conf" "%CROWDSEC_KEY%" "$CROWDSEC_KEY" fi + +# Whitelist IP for API +if [ "$USE_API" = "yes" ] ; then + list=$(spaces_to_lua "$API_WHITELIST_IP") + replace_in_file "/usr/local/lib/lua/api.lua" "%API_WHITELIST_IP%" "$list" +fi