added key file creation

main
Ebbe Baß 2025-09-26 09:34:30 +02:00
parent d8a438f33c
commit faef640e78
1 changed files with 12 additions and 0 deletions

View File

@ -1,14 +1,26 @@
import sqlite3
import random
from fastapi import FastAPI, HTTPException, Depends
from typing import List, Optional
from threading import Lock
from datetime import datetime, timedelta
import os
app = FastAPI()
DB_PATH = './database/schloter.API.db'
lock = Lock()
# Create allowed_tokens.txt with example keys if it doesn't exist
def ensure_allowed_tokens_file(path='allowed_tokens.txt'):
if not os.path.exists(path):
with open(path, 'w') as f:
f.write('examplekey1\nexamplekey2\n')
print(f"Created {path} with example keys.")
ensure_allowed_tokens_file('allowed_tokens.txt')
# Database initialization
def init_db():
import os