geoip.lua

changeset 19
fd7b581560d5
parent 16
d35376a53644
child 20
fed4cf6b1f43
equal deleted inserted replaced
18:8050134f35b3 19:fd7b581560d5
1 pcall(function () 1 local log = require "util.logger".init("geoip");
2
3 local ok, err = pcall(function ()
2 local city_db_path = os.getenv("GEOIP_CITY_DB"); 4 local city_db_path = os.getenv("GEOIP_CITY_DB");
3 if not city_db_path then return; end 5 if not city_db_path then return; end
4 6
5 local city_db = assert(require "geoip.city".open(city_db_path)); 7 local city_db = assert(require "geoip.city".open(city_db_path));
6 8
20 end 22 end
21 conn.location = table.concat(l, ", "); 23 conn.location = table.concat(l, ", ");
22 end 24 end
23 end); 25 end);
24 end) 26 end)
27
28 if not ok then
29 log("warn", "GeoIP loading failed: %s", tostring(err));
30 end

mercurial