This commit is contained in:
followcube
2021-06-08 21:53:20 +03:00
parent 0f7bd9951b
commit 182b6e0000
6 changed files with 1231 additions and 3 deletions

View File

@ -16,6 +16,6 @@ frontend http-in
# http-request lua.test-payload # http-request lua.test-payload
http-request use-service lua.hello-world if { path /hello_world } http-request use-service lua.hello-world if { path /hello_world }
http-request use-service lua.hcaptcha-view if { path /captcha } http-request use-service lua.hcaptcha-view if { path /captcha }
http-request use-service lua.ratelimit if { path /test }
backend servers backend servers
server server1 nginx:80 maxconn 32 server server1 nginx:80 maxconn 32

8
scripts/counter.lua Normal file
View File

@ -0,0 +1,8 @@
--
-- Created by IntelliJ IDEA.
-- User: dinoz
-- Date: 08.06.2021
-- Time: 15:28
-- To change this template use File | Settings | File Templates.
--

1203
scripts/redis.lua Normal file

File diff suppressed because it is too large Load Diff

View File

@ -2,6 +2,9 @@ package.path = package.path .. "./?.lua;/usr/local/etc/haproxy/scripts/?.lua"
require("guard") require("guard")
require("hcaptcha") require("hcaptcha")
require("test")
core.register_service("hello-world", "http", guard.hello_world) --core.register_service("hello-world", "http", guard.hello_world)
core.register_service("hcaptcha-view", "http", hcaptcha.view) --core.register_service("hcaptcha-view", "http", hcaptcha.view)
--core.register_service("test", "http", test.hello_world2)
core.register_service("ratelimit", "http", test.ratelimit)

6
scripts/test.lua Normal file
View File

@ -0,0 +1,6 @@
package.path = package.path .. "./?.lua;/usr/local/etc/haproxy/scripts/?.lua"
local redis = require 'redis'
client = redis.connect('127.0.0.1', 6379)
response = client:ping()

8
scripts/test2.lua Normal file
View File

@ -0,0 +1,8 @@
package.path = package.path .. "./?.lua;/usr/local/etc/haproxy/scripts/?.lua"
require("redis")
local redis = require 'redis'
local client = redis.connect('127.0.0.1', 6379)
local response = client:ping()
local dummy = client:get('dummy')
print(dummy)