added key file creation
parent
d8a438f33c
commit
faef640e78
12
api/main.py
12
api/main.py
|
|
@ -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
|
||||
|
|
|
|||
Loading…
Reference in New Issue