vpn integration
This commit is contained in:
@@ -0,0 +1,39 @@
|
||||
import os
|
||||
|
||||
import uvicorn
|
||||
|
||||
|
||||
def build_config() -> dict:
|
||||
debug = os.getenv("DEBUG", "true").lower() == "true"
|
||||
|
||||
config = {
|
||||
"host": os.getenv("UVICORN_HOST", "0.0.0.0"),
|
||||
"port": int(os.getenv("UVICORN_PORT", "8000")),
|
||||
"loop": "asyncio",
|
||||
"ws": "websockets",
|
||||
"proxy_headers": True,
|
||||
"forwarded_allow_ips": "*",
|
||||
"log_level": "debug" if debug else "info",
|
||||
"access_log": True
|
||||
}
|
||||
|
||||
if debug:
|
||||
config.update(
|
||||
{
|
||||
"reload": True,
|
||||
"reload_dirs": ["."],
|
||||
"workers": 1,
|
||||
}
|
||||
)
|
||||
else:
|
||||
config.update(
|
||||
{
|
||||
"workers": int(os.getenv("UVICORN_WORKERS", "5")),
|
||||
}
|
||||
)
|
||||
|
||||
return config
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
uvicorn.run("app.asgi:application", **build_config())
|
||||
Reference in New Issue
Block a user