feat(rotor): support loading MaxMind databases from a local path#1401
Open
UditDewan wants to merge 1 commit into
Open
feat(rotor): support loading MaxMind databases from a local path#1401UditDewan wants to merge 1 commit into
UditDewan wants to merge 1 commit into
Conversation
Adds MAXMIND_PATH env var as an alternative to MAXMIND_LICENSE_KEY, MAXMIND_URL and MAXMIND_S3_BUCKET. The path can point to a directory containing <Edition>.mmdb or <Edition>.tar.gz files (the layout produced by MaxMind's geoipupdate tool) or to a single such file. Closes jitsucom#1080
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What
Adds a
MAXMIND_PATHenvironment variable to rotor so GeoIP databases can be loaded from the local filesystem, as an alternative toMAXMIND_LICENSE_KEY,MAXMIND_URLandMAXMIND_S3_BUCKET.Closes #1080
How it works
MAXMIND_PATHcan point to:<Edition>.mmdbor<Edition>.tar.gzfiles (e.g.GeoLite2-City.mmdb,GeoLite2-ASN.mmdb) — this is exactly the layout produced by MaxMind's official geoipupdate tool, so a volume shared with a geoipupdate sidecar works out of the box;/data/GeoLite2-City.mmdbor/data/GeoIP2-City.tar.gz.Missing editions degrade the same way they do for the URL/S3 loaders: the existing paid→free fallback logic in
download()is reused unchanged, and if nothing can be loaded rotor falls back to the dummy resolver with a warning instead of crashing.Testing
services/rotor/__tests__/maxmind-path.test.tscover directory lookup, single-file lookup, tar.gz extraction and error cases (vitest run __tests__/maxmind-path.test.ts— 4 passed).pnpm typecheckand eslint pass on the touched files.