]> git.ipfire.org Git - thirdparty/knot-resolver.git/commitdiff
http: error out if GeoIP is requested but mmdblua is not available
authorPetr Špaček <petr.spacek@nic.cz>
Tue, 12 Dec 2017 16:46:47 +0000 (17:46 +0100)
committerPetr Špaček <petr.spacek@nic.cz>
Tue, 12 Dec 2017 16:46:47 +0000 (17:46 +0100)
modules/http/README.rst
modules/http/http.lua

index 96f1da4ac87e3c6b94003973a045977c6c8a4523..a3ecfc2c068cb5ca07c41e6f080f3918dfd40455 100644 (file)
@@ -28,7 +28,9 @@ for starters?
                http = {
                        host = 'localhost',
                        port = 8053,
-                       geoip = 'GeoLite2-City.mmdb' -- Optional
+                       geoip = 'GeoLite2-City.mmdb' -- Optional, see
+                       -- e.g. https://dev.maxmind.com/geoip/geoip2/geolite2/
+                       -- and install mmdblua library
                }
        }
 
index 7b3cffa144cbb8f9f1b772c55d152ce3a4174e91..361fac8ee12b07f65dcd8aa29619c8823658dbe9 100644 (file)
@@ -352,7 +352,13 @@ function M.config(conf)
        -- Configure web interface for resolver
        if not conf.port then conf.port = 8053 end
        if not conf.host then conf.host = 'localhost' end
-       if conf.geoip and has_mmdb then M.geoip = mmdb.open(conf.geoip) end
+       if conf.geoip then
+               if has_mmdb then
+                       M.geoip = mmdb.open(conf.geoip)
+               else
+                       error('[http] mmdblua library not found, please remove GeoIP configuration')
+               end
+       end
        M.interface(conf.host, conf.port, M.endpoints, conf.cert, conf.key)
        -- TODO: configure DNS/HTTP(s) interface
        if M.ev then return end