fix wrong init of counter in badbehavior and fix nextcloud/docker example

This commit is contained in:
bunkerity 2023-04-05 17:31:22 +02:00
parent 8e72050625
commit 41e8f5c937
2 changed files with 7 additions and 6 deletions

View File

@ -10,6 +10,7 @@ services:
- SERVER_NAME=www.example.com # replace with your domain
- AUTO_LETS_ENCRYPT=yes
- DISABLE_DEFAULT_SERVER=yes
- API_WHITELIST_IP=127.0.0.1 10.20.30.0/24
- MAX_CLIENT_SIZE=10G
- USE_CLIENT_CACHE=yes
- SERVE_FILES=no
@ -84,9 +85,9 @@ services:
- TRUSTED_PROXIES=192.168.0.0/16 172.16.0.0/12 10.0.0.0/8
- APACHE_DISABLE_REWRITE_IP=1
- MYSQL_HOST=mydb
- MYSQL_DATABASE=${NEXTCLOUD_DATABASE:-nextclouddb}
- MYSQL_USER=${NEXTCLOUD_USER:-user}
- MYSQL_PASSWORD=${NEXTCLOUD_PASSWORD:-secret} # set a stronger password in a .env file (must match MYSQL_PASSWORD)
- MYSQL_DATABASE=nc
- MYSQL_USER=user
- MYSQL_PASSWORD=db-user-pwd # set a stronger password in a .env file (must match MYSQL_PASSWORD)
networks:
- bw-services
@ -94,7 +95,7 @@ services:
image: mariadb:10.9
command: --transaction-isolation=READ-COMMITTED --binlog-format=ROW
volumes:
- ./db-data:/var/lib/mysql
- db-data:/var/lib/mysql
environment:
- MYSQL_ROOT_PASSWORD=db-root-pwd # replace with a stronger password
- MYSQL_DATABASE=nc

View File

@ -31,9 +31,9 @@ function _M.increase(premature, use_redis, ip, count_time, ban_time, threshold)
return false, "can't get counts from the datastore : " .. err
end
if local_counter == nil then
counter = 0
local_counter = 0
end
counter = counter + 1
counter = local_counter + 1
end
-- Call decrease later
local ok, err = ngx.timer.at(count_time, _M.decrease, use_redis, ip)