add host and port as env

This commit is contained in:
ThePhaseless
2025-10-01 12:09:53 +00:00
parent f4daffca61
commit 39b804da55
3 changed files with 8 additions and 6 deletions
+3 -2
View File
@@ -34,9 +34,10 @@ Built with [camoufox](https://camoufox.com/) and [FastAPI](https://fastapi.tiang
## Options
| Environment Variable | Default | Description |
| -------------------- | --------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| -------------------- | --------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------- | --- |
| `HOST` | `0.0.0.0` | Host address to bind the server to. Use `0.0.0.0` to bind to all IPv4 interfaces, `::` for all IPv6 interfaces, or `127.0.0.1`/`localhost` for local access only. |
| `PROXY_SERVER` | None | Proxy to use in format: `protocol://host:port`. |
| `PORT` | `8196` | Port to bind the server to. |
| `PROXY_SERVER` | None | Proxy to use in format: `protocol://host:port`. | w |
| `PROXY_USERNAME` | None | |
| `PROXY_PASSWORD` | None | |
+2 -4
View File
@@ -2,14 +2,13 @@ from __future__ import annotations
import asyncio
import logging
import os
import sys
import uvicorn
from fastapi import FastAPI
from fastapi.middleware.gzip import GZipMiddleware
from src.consts import LOG_LEVEL, VERSION
from src.consts import HOST, LOG_LEVEL, PORT, VERSION
from src.endpoints import health_check, router
from src.middlewares import LogRequest
from src.utils import get_camoufox, logger
@@ -39,5 +38,4 @@ if __name__ == "__main__":
loop.run_until_complete(init())
logger.info("Initialization complete.")
else:
host = os.getenv("HOST", "0.0.0.0") # noqa: S104
uvicorn.run(app, host=host, port=8191)
uvicorn.run(app, host=HOST, port=PORT)
+3
View File
@@ -19,6 +19,9 @@ PROXY_SERVER = os.getenv("PROXY_SERVER")
PROXY_USERNAME = os.getenv("PROXY_USERNAME")
PROXY_PASSWORD = os.getenv("PROXY_PASSWORD")
HOST = os.getenv("HOST", "0.0.0.0")
PORT = int(os.getenv("PORT", "8191"))
CHALLENGE_TITLES_MAP: dict[CaptchaType, list[str]] = {
# Cloudflare
CaptchaType.CLOUDFLARE_INTERSTITIAL: ["Just a moment..."],