feat: Implement initial FastAPI application structure with configuration, core services, and an admin UI.
This commit is contained in:
@@ -14,5 +14,7 @@ class Settings:
|
||||
ALGORITHM: str = "HS256"
|
||||
ACCESS_TOKEN_EXPIRE_MINUTES: int = 60
|
||||
ADMIN_PASSWORD: str = os.getenv("ADMIN_PASSWORD", "admin123")
|
||||
ENVIRONMENT: str = os.getenv("ENVIRONMENT", "development")
|
||||
|
||||
|
||||
settings = Settings()
|
||||
|
||||
17
app/main.py
17
app/main.py
@@ -17,7 +17,16 @@ from app.api.endpoints import auth
|
||||
from app.api import admin_backend
|
||||
|
||||
def create_application() -> FastAPI:
|
||||
application = FastAPI(title=settings.PROJECT_NAME)
|
||||
# Disable docs and redoc in production
|
||||
docs_url = "/docs" if settings.ENVIRONMENT == "development" else None
|
||||
redoc_url = "/redoc" if settings.ENVIRONMENT == "development" else None
|
||||
|
||||
application = FastAPI(
|
||||
title=settings.PROJECT_NAME,
|
||||
docs_url=docs_url,
|
||||
redoc_url=redoc_url
|
||||
)
|
||||
|
||||
|
||||
# Mount Static Files
|
||||
application.mount("/static", StaticFiles(directory="app/static"), name="static")
|
||||
@@ -53,4 +62,8 @@ async def admin_panel():
|
||||
|
||||
@app.get("/")
|
||||
async def root():
|
||||
return {"message": "Welcome to Storyline AI Gateway", "docs": "/docs"}
|
||||
response = {"message": "Welcome to Storyline AI Gateway"}
|
||||
if settings.ENVIRONMENT == "development":
|
||||
response["docs"] = "/docs"
|
||||
return response
|
||||
|
||||
|
||||
@@ -4,7 +4,7 @@
|
||||
<head>
|
||||
<meta charset="UTF-8">
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
||||
<title>Storyline AI Gateway - Admin</title>
|
||||
<title>AI Gateway - Admin</title>
|
||||
<link rel="preconnect" href="https://fonts.googleapis.com">
|
||||
<link rel="preconnect" href="https://fonts.gstatic.com" crossorigin>
|
||||
<link href="https://fonts.googleapis.com/css2?family=Outfit:wght@300;400;600;800&display=swap" rel="stylesheet">
|
||||
@@ -398,7 +398,7 @@
|
||||
<div class="bg-gradient"></div>
|
||||
<div class="container">
|
||||
<header>
|
||||
<div class="logo">Storyline Gateway Admin</div>
|
||||
<div class="logo">AI Gateway Admin</div>
|
||||
<button id="logout-btn" class="btn-small btn-outline hidden">Logout</button>
|
||||
</header>
|
||||
|
||||
|
||||
4
main.py
4
main.py
@@ -6,4 +6,6 @@ load_dotenv()
|
||||
|
||||
if __name__ == "__main__":
|
||||
port = int(os.getenv("PORT", 8000))
|
||||
uvicorn.run("app.main:app", host="0.0.0.0", port=port, reload=True)
|
||||
is_development = os.getenv("ENVIRONMENT", "development") == "development"
|
||||
uvicorn.run("app.main:app", host="0.0.0.0", port=port, reload=is_development)
|
||||
|
||||
|
||||
Reference in New Issue
Block a user