register

Function register 

Source
pub fn register(lua: &Lua, options: LuaTable) -> LuaResult<()>
Expand description

Register GeoIP2 lookups in the haproxy

This function registers the GeoIP2 lookups converters in the haproxy Lua environment, including task to reload the databases at a given interval.

The following Lua options are supported:

  • reload_interval: Interval in seconds to reload the databases. Default is 0.
  • db.city: Path to the MaxMind GeoIP2 City database.
  • db.asn: Path to the MaxMind GeoIP2 ASN database.

ยงExample

geoip2.register({
   reload_interval = 86400, -- 1 day
   db = {
       city = "/path/to/GeoLite2-City.mmdb",
        asn = "/path/to/GeoLite2-ASN.mmdb",
    },
})