Fix issue #3 : allow DISABLE_CARDS envvar
This commit is contained in:
@@ -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()
|
||||
|
||||
|
||||
Reference in New Issue
Block a user