mirror of
https://github.com/cyberbread-ru/notepad-server.git
synced 2026-07-14 12:51:04 +03:00
initial vibecoded... thing
This commit is contained in:
@@ -0,0 +1,25 @@
|
||||
import os
|
||||
import secrets
|
||||
|
||||
from fastapi import FastAPI
|
||||
from app.routes import router
|
||||
from app.store import init_db
|
||||
|
||||
# If no API_KEY is set, generate one and print it (first-run helper)
|
||||
if not os.getenv("API_KEY"):
|
||||
generated = secrets.token_urlsafe(32)
|
||||
os.environ["API_KEY"] = generated
|
||||
print(f"\n⚠️ No API_KEY set — using generated key for this session:")
|
||||
print(f" API_KEY={generated}")
|
||||
print(" Set it permanently with: export API_KEY=<your-key>\n")
|
||||
|
||||
app = FastAPI(title="Notepad Backup Server", version="1.0.0")
|
||||
|
||||
init_db()
|
||||
|
||||
app.include_router(router)
|
||||
|
||||
|
||||
@app.get("/health")
|
||||
def health():
|
||||
return {"status": "ok"}
|
||||
Reference in New Issue
Block a user