Fix issue #3 : allow DISABLE_CARDS envvar

This commit is contained in:
2026-06-12 13:32:55 +02:00
parent 9985251584
commit 5e8c826714

View File

@@ -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()