feat: Disable file watching for production mode
Can be toggled with 'BEES_DEVMODE=True/False' env var.
This commit is contained in:
parent
909fb37f9a
commit
b6e91565e0
2 changed files with 7 additions and 3 deletions
|
|
@ -138,7 +138,7 @@ def start() -> None:
|
||||||
|
|
||||||
config = AppConfig.from_env()
|
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__":
|
if __name__ == "__main__":
|
||||||
|
|
|
||||||
|
|
@ -10,12 +10,16 @@ _ = load_dotenv()
|
||||||
|
|
||||||
@dataclass
|
@dataclass
|
||||||
class AppConfig:
|
class AppConfig:
|
||||||
|
DEVMODE: bool
|
||||||
PORT: int
|
PORT: int
|
||||||
|
|
||||||
@classmethod
|
@classmethod
|
||||||
def from_env(cls) -> "AppConfig":
|
def from_env(cls) -> "AppConfig":
|
||||||
PORT = os.getenv("PORT", "8000")
|
PORT = os.getenv("BEES_PORT", os.getenv("PORT", "8000"))
|
||||||
return cls(PORT=int(PORT))
|
return cls(
|
||||||
|
PORT=int(PORT),
|
||||||
|
DEVMODE=bool(os.getenv("BEES_DEVMODE", False))
|
||||||
|
)
|
||||||
|
|
||||||
|
|
||||||
@dataclass
|
@dataclass
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue