Unverified Commit 4faa026e authored by julienmancuso's avatar julienmancuso Committed by GitHub
Browse files

feat: allow to set http port (#931)

parent 67fc3b8c
......@@ -313,14 +313,16 @@ def main(
if added_routes:
# Configure uvicorn with graceful shutdown
# get the port from PORT env var or use 8000 as default
port = int(os.environ.get("PORT", 8000))
config = uvicorn.Config(
service.app, host="0.0.0.0", port=8000, log_level="info"
service.app, host="0.0.0.0", port=port, log_level="info"
)
server = uvicorn.Server(config)
# Start the server with graceful shutdown handling
logger.info(
f"Starting FastAPI server on 0.0.0.0:8000 with routes: {added_routes}"
f"Starting FastAPI server on 0.0.0.0:{port} with routes: {added_routes}"
)
server.run()
else:
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment