From 5e8c826714183b52a68f0cb7483f9830d2d2a80f Mon Sep 17 00:00:00 2001 From: ahtlon Date: Fri, 12 Jun 2026 13:32:55 +0200 Subject: [PATCH] Fix issue #3 : allow DISABLE_CARDS envvar --- app/main.py | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/app/main.py b/app/main.py index a93f0d6..88b8545 100644 --- a/app/main.py +++ b/app/main.py @@ -21,8 +21,7 @@ def checkDeps(): if not MIFARE_APP_MASTER_KEY: logger.critical(f"MIFARE APP MASTER KEY not found!") logger.critical("Writing and reading cards is disabled!") - global disableCards - disableCards = True + @asynccontextmanager async def lifespan(app: FastAPI): @@ -30,7 +29,9 @@ async def lifespan(app: FastAPI): create_db_and_tables() create_first_user(db=get_db_session()) logger.info("Database created and tables initialized.") - scanner.start() + disableCards = os.getenv("DISABLE_CARDS") + if not disableCards: + scanner.start() yield #scanner.stop()