support SERVE_HOST env var for binding to 0.0.0.0
This commit is contained in:
@@ -11,6 +11,7 @@ import httpx
|
||||
SCRIPT_DIR = Path(__file__).resolve().parent
|
||||
STATIC_DIR = SCRIPT_DIR
|
||||
PORT = int(os.environ.get("SERVE_PORT", "18834"))
|
||||
HOST = os.environ.get("SERVE_HOST", "127.0.0.1")
|
||||
|
||||
app = FastAPI(title="Project Directory")
|
||||
|
||||
@@ -192,4 +193,4 @@ async def index(path: str = ""):
|
||||
|
||||
if __name__ == "__main__":
|
||||
import uvicorn
|
||||
uvicorn.run(app, host="127.0.0.1", port=PORT)
|
||||
uvicorn.run(app, host=HOST, port=PORT)
|
||||
|
||||
Reference in New Issue
Block a user