telize

High performance JSON IP and GeoIP REST API (IP Geolocation)
Log | Files | Refs | README | LICENSE

commit 64760fd818b9c94861cc674d4706fb0cb1650e6a
parent 7ab5df8804b7144799f53e74ce5ca84a099c867a
Author: Frederic Cambus <fred@statdns.com>
Date:   Fri, 20 Mar 2020 18:14:06 +0100

Introduce and use the GEOIP2DIR macro, to avoid hardcoding DB paths.

Diffstat:
Msrc/utils.c | 6++++--
1 file changed, 4 insertions(+), 2 deletions(-)

diff --git a/src/utils.c b/src/utils.c @@ -12,6 +12,8 @@ #include "telize.h" +#define GEOIP2DIR "/var/db/GeoIP/" + MMDB_s telize_asn; MMDB_s telize_city; @@ -24,11 +26,11 @@ telize_init(int state) return (KORE_RESULT_OK); } - if (MMDB_open("/var/db/GeoIP/GeoLite2-City.mmdb", + if (MMDB_open(GEOIP2DIR "GeoLite2-City.mmdb", MMDB_MODE_MMAP, &telize_city) != MMDB_SUCCESS) fatalx("can't open GeoLite2 City database: %s", errno_s); - if (MMDB_open("/var/db/GeoIP/GeoLite2-ASN.mmdb", + if (MMDB_open(GEOIP2DIR "GeoLite2-ASN.mmdb", MMDB_MODE_MMAP, &telize_asn) != MMDB_SUCCESS) fatalx("can't open GeoLite2 ASN database: %s", errno_s);