diff options
Diffstat (limited to '__main__.py')
-rw-r--r-- | __main__.py | 8 |
1 files changed, 5 insertions, 3 deletions
diff --git a/__main__.py b/__main__.py index 9dba645..9b23484 100644 --- a/__main__.py +++ b/__main__.py @@ -4,13 +4,15 @@ from typing import Annotated from fastapi import FastAPI, Depends from .apirouters import agents -from .modules import database +from .modules.database import cursor, conn @asynccontextmanager async def lifespan(app: FastAPI): - database.cursor.execute( - "CREATE TABLE IF NOT EXISTS agents(primary_key INTEGER PRIMARY KEY, callsign TEXT NOT NULL UNIQUE, token_hash TEXT NOT NULL)") + cursor.execute( + "CREATE TABLE IF NOT EXISTS agents(primary_key INTEGER PRIMARY KEY, callsign TEXT NOT NULL UNIQUE, token TEXT NOT NULL)") + conn.commit() + agents.load_agents_from_database() yield |