File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 11# GeoIP service
22GEOIP_DB_DIR=/data/geoip
3+ HOST=::
34PORT=8080
45
56# Local API -> GeoIP service
Original file line number Diff line number Diff line change @@ -29,6 +29,7 @@ MAXMIND_LICENSE_KEY=<secret>
2929MAXMIND_EDITION_IDS=GeoLite2-City GeoLite2-ASN
3030GEOIP_DB_DIR=/data/geoip
3131GEOIP_UPDATE_INTERVAL_HOURS=24
32+ HOST=::
3233PORT=8080
3334```
3435
@@ -57,10 +58,12 @@ GEOIP_SERVICE_URL=http://localhost:8083
5758
5859Deploy this app as its own Railway service named ` geoip ` .
5960
61+ The service binds to ` :: ` by default so Railway private networking can reach it in both new dual-stack environments and older IPv6-only ones.
62+
6063The main API should use:
6164
6265``` env
63- GEOIP_SERVICE_URL=http://geoip.railway.internal
66+ GEOIP_SERVICE_URL=http://geoip.railway.internal:8080
6467```
6568
6669Only the ` geoip ` service needs the MaxMind credentials.
Original file line number Diff line number Diff line change @@ -22,6 +22,7 @@ class Settings:
2222 license_key : str
2323 edition_ids : tuple [str , ...]
2424 db_dir : Path
25+ host : str
2526 update_interval_hours : int
2627 port : int
2728
@@ -48,7 +49,7 @@ def from_env(cls) -> "Settings":
4849 license_key = os .getenv ("MAXMIND_LICENSE_KEY" , "" ).strip (),
4950 edition_ids = _split_edition_ids (os .getenv ("MAXMIND_EDITION_IDS" )),
5051 db_dir = Path (os .getenv ("GEOIP_DB_DIR" , "/data/geoip" )),
52+ host = os .getenv ("HOST" , "::" ).strip () or "::" ,
5153 update_interval_hours = int (os .getenv ("GEOIP_UPDATE_INTERVAL_HOURS" , "24" )),
5254 port = int (os .getenv ("PORT" , "8080" )),
5355 )
54-
Original file line number Diff line number Diff line change @@ -70,4 +70,4 @@ async def lookup(payload: LookupRequest) -> LookupResponse:
7070
7171if __name__ == "__main__" :
7272 settings = Settings .from_env ()
73- uvicorn .run ("src.main:app" , host = "0.0.0.0" , port = settings .port )
73+ uvicorn .run ("src.main:app" , host = settings . host , port = settings .port )
You can’t perform that action at this time.
0 commit comments