feat: Disable file watching for production mode

Can be toggled with 'BEES_DEVMODE=True/False' env var.
This commit is contained in:
Marty Oehme 2025-07-22 12:02:01 +02:00
parent 909fb37f9a
commit b6e91565e0
Signed by: Marty
GPG key ID: 4E535BC19C61886E
2 changed files with 7 additions and 3 deletions

View file

@ -138,7 +138,7 @@ def start() -> None:
config = AppConfig.from_env()
run("prophet.app:app", reload=True, host="0.0.0.0", port=config.PORT)
run("prophet.app:app", reload=config.DEVMODE, host="0.0.0.0", port=config.PORT)
if __name__ == "__main__":

View file

@ -10,12 +10,16 @@ _ = load_dotenv()
@dataclass
class AppConfig:
DEVMODE: bool
PORT: int
@classmethod
def from_env(cls) -> "AppConfig":
PORT = os.getenv("PORT", "8000")
return cls(PORT=int(PORT))
PORT = os.getenv("BEES_PORT", os.getenv("PORT", "8000"))
return cls(
PORT=int(PORT),
DEVMODE=bool(os.getenv("BEES_DEVMODE", False))
)
@dataclass