refactor run script with env varsa
This commit is contained in:
23
scripts/run_webapp.py
Executable file
23
scripts/run_webapp.py
Executable file
@@ -0,0 +1,23 @@
|
||||
import os
|
||||
import subprocess
|
||||
from dotenv import load_dotenv
|
||||
|
||||
load_dotenv("env")
|
||||
|
||||
# Get variables with defaults
|
||||
PORT = os.getenv("PORT", "9999")
|
||||
RELOAD = os.getenv("RELOAD", "True").lower() == "true"
|
||||
|
||||
# Build the command
|
||||
cmd = [
|
||||
"uvicorn",
|
||||
"main:app",
|
||||
"--host 0.0.0.0",
|
||||
"--port", PORT
|
||||
]
|
||||
|
||||
if RELOAD:
|
||||
cmd.append("--reload")
|
||||
|
||||
|
||||
subprocess.run(cmd)
|
||||
@@ -1,3 +0,0 @@
|
||||
#!/bin/bash
|
||||
|
||||
uvicorn main:app --host 0.0.0.0 --port 9999 --reload
|
||||
Reference in New Issue
Block a user