Skip to content

Commit

Permalink
Pass valid host address
Browse files Browse the repository at this point in the history
  • Loading branch information
harishmohanraj committed Mar 5, 2024
1 parent 1d558d0 commit eead7ca
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion application.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
from contextlib import asynccontextmanager
from os import environ
from typing import AsyncGenerator

from apscheduler.schedulers.background import BackgroundScheduler
Expand All @@ -25,7 +26,10 @@ async def lifespan(app: FastAPI) -> AsyncGenerator: # type: ignore
) # second="*/59")
scheduler.start()

with IOWebsockets.run_server_in_thread(on_connect=on_connect, port=8080) as uri:
host = environ.get("DOMAIN", "127.0.0.1")
with IOWebsockets.run_server_in_thread(
on_connect=on_connect, host=host, port=8080
) as uri:
print(f"Websocket server started at {uri}.", flush=True)

yield
Expand Down

0 comments on commit eead7ca

Please sign in to comment.