paulbsd-salt/states/haproxy/scripts/geoip.lua

20 lines
412 B
Lua
Raw Permalink Normal View History

2023-04-13 23:13:34 +02:00
local compile = require("compile")
compile.check("haproxy")
local haproxy = require("haproxy")
local args = table.pack(...)
load_geoip(args[1])
local function country(txn, var1)
local src = txn:get_var(var1)
return get_country(src)
end
local function city(txn, var1)
local src = txn:get_var(var1)
return get_city(src)
end
core.register_fetches("country", country)
core.register_fetches("city", city)