g-andrade / locus

MMDB reader for geolocation and ASN lookup of IP addresses
https://hexdocs.pm/locus/
MIT License
109 stars 14 forks source link

How to use the database provided by the OS? #6

Closed leoliu closed 4 years ago

leoliu commented 4 years ago

My CentOS provides an update-to-date DB: /usr/share/GeoIP/GeoLite2-City.mmdb. But locus seems to want a tar ball instead. Is it possible to make it support system-provided DB which simplifies deployment a lot? Thanks.

g-andrade commented 4 years ago

I've got some unreleased changes under the develop branch that would make this reasonably easy to implement.

I'll leave this issue open as a reminder.

g-andrade commented 4 years ago

I've added experimental support for direct load of .mmdb files on 7477a1cd4dc (yet unreleased.)

Please try it and let me know whether that works for you.

URL = "/usr/share/GeoIP/GeoLite2-City.mmdb",
ok = locus:start_loader(city, URL).
leoliu commented 4 years ago

I just tested it with the develop and it works like a charm. Thanks a lot for the quick fix.

g-andrade commented 4 years ago

A new version, 1.7.0, has been released and it includes support for multiple file formats, including unpacked mmdb files.

Closing this; please re-open (or open a new issue) if you find any problems.