Environment Configuration
MaxMind
IPTools uses two MaxMind databases: GeoLite2-ASN.mmdb and GeoLite2-City.mmdb. You only need these files if you call the geoip functions.
Obtaining the files
The recommended way to keep these files up to date is using the geoipupdate tool (official docs).
- Install
geoipupdate:- macOS:
brew install geoipupdate - Linux: Use your package manager (e.g.,
apt install geoipupdate) or download from GitHub Releases.
- macOS:
- Configure:
- Create a
GeoIP.conffile (usually in/usr/local/etc/or/etc/). - Add your
AccountID,LicenseKey, andEditionIDs(e.g.,GeoLite2-ASN GeoLite2-City).
- Create a
- Run:
- Execute
geoipupdateto download the files.
- Execute
Configuration
Set the MAXMIND_MMDB_DIR environment variable to tell the extension where these files are located.
export MAXMIND_MMDB_DIR=/path/to/your/mmdb/files
# or Windows users
set MAXMIND_MMDB_DIR=c:\path\to\your\mmdb\files
If the environment is not set, polars_iptools will check two other common locations (on Mac/Linux):
Spur
If you're a Spur customer, you can use their anonymous feed in MMDB format.
Obtaining the file
You can download the anonymous feed as an MMDB file using the Spur Exports API (official docs):
curl --get "https://exports.spur.us/v1/feeds/anonymous" \
--data-urlencode "output=mmdb" \
-H "Token: $SPUR_TOKEN" \
-o spur.mmdb
Configuration
Export the feed as spur.mmdb and specify its location using SPUR_MMDB_DIR environment variable.