Fix IPv4 interface bind in production, fix reloader enabled in production

This commit is contained in:
2024-11-01 17:45:37 -05:00
parent 65701b7178
commit 52df0c571f
+5 -2
View File
@@ -28,14 +28,17 @@ def main(*args):
- Don't import any modules globally unless you're certain it's necessary. Imports should be tightly controlled.
"""
if args[0] == "serve":
from linkpulse.utilities import is_development
from uvicorn import run
logger.debug("Invoking uvicorn.run")
run(
"linkpulse.app:app",
reload=True,
host="0.0.0.0",
reload=is_development,
# Both options are special IP addresses that allow the server to listen on all network interfaces. One is for IPv4, the other for IPv6.
# Railway's private networking requires IPv6, so we must use that in production.
host="0.0.0.0" if is_development else "::",
port=int(os.getenv("PORT", "8000")),
log_config={
"version": 1,