Pārlūkot izejas kodu

made captcha url configurable

Tobias von Dewitz 7 gadi atpakaļ
vecāks
revīzija
1e78730e4c
1 mainītis faili ar 4 papildinājumiem un 2 dzēšanām
  1. 4 2
      lua/scw.lua

+ 4 - 2
lua/scw.lua

@@ -92,7 +92,9 @@ function scw(r)
     end
   end
 
-  if has_redis then
+  local captcha_url = os.getenv("SCW_CAPTCHA_URL")
+
+  if has_redis and captcha_url ~= "" then
     -- io.stderr:write(string.format("ip: %s\n", r.useragent_ip))
     local v = redis_conn:get("bl:" .. r.useragent_ip)
     -- local h = redis_conn:get("h:" .. r.useragent_ip)
@@ -109,7 +111,7 @@ function scw(r)
       end
 
       local referer = string.format("%s://%s%s%s", rprotocol, r.hostname, rport, r.unparsed_uri)
-      r.headers_out["location"] = string.format("http://docker.scw.systems:8003/?src=%s&r=%s", r.useragent_ip, r:escape(referer))
+      r.headers_out["location"] = string.format(captcha_url, r.useragent_ip, r:escape(referer))
 --[[
       r.headers_in["X-SCW-IP"] = v
       r.handler = "proxy-server"