diff --git a/env b/env index 37e8d612f..781ce8bf9 100644 --- a/env +++ b/env @@ -2,6 +2,7 @@ MASTER_KEY=blahblahblah DOMAIN=localhost SITE_ID=TheMotte SITE_TITLE=The Motte +ENFORCE_PRODUCTION=False GIPHY_KEY=blahblahblah DISCORD_SERVER_ID=blahblahblah DISCORD_CLIENT_ID=blahblahblah diff --git a/files/__main__.py b/files/__main__.py index 253985805..a3b361313 100644 --- a/files/__main__.py +++ b/files/__main__.py @@ -27,6 +27,9 @@ app.jinja_env.cache = {} app.jinja_env.auto_reload = True faulthandler.enable() +if environ.get("ENFORCE_PRODUCTION", False) and app.config["DEBUG"]: + raise ValueError("Debug mode is not allowed! If this is a dev environment, please set ENFORCE_PRODUCTION to false") + if environ.get("SITE_ID") is None: from dotenv import load_dotenv load_dotenv(dotenv_path=Path("env"))