feat: Add environment configuration files and update settings for production and development
This commit is contained in:
14
app/main.py
14
app/main.py
@@ -6,6 +6,7 @@ from fastapi import FastAPI
|
||||
from fastapi.middleware.cors import CORSMiddleware
|
||||
|
||||
from app.api import api_router
|
||||
from app.core.config import settings
|
||||
from app.core.database import get_session_factory, init_db
|
||||
from app.core.logging import get_logger, setup_logging
|
||||
from app.middleware.logging import LoggingMiddleware
|
||||
@@ -47,12 +48,21 @@ async def lifespan(_app: FastAPI) -> AsyncGenerator[None, None]:
|
||||
|
||||
def create_app() -> FastAPI:
|
||||
"""Create and configure the FastAPI application."""
|
||||
app = FastAPI(lifespan=lifespan)
|
||||
app = FastAPI(
|
||||
title="Soundboard API",
|
||||
description="API for the Soundboard application with authentication, sound management, and real-time features",
|
||||
version="1.0.0",
|
||||
lifespan=lifespan,
|
||||
# Configure docs URLs for reverse proxy setup
|
||||
docs_url="/api/docs", # Swagger UI at /api/docs
|
||||
redoc_url="/api/redoc", # ReDoc at /api/redoc
|
||||
openapi_url="/api/openapi.json" # OpenAPI schema at /api/openapi.json
|
||||
)
|
||||
|
||||
# Add CORS middleware
|
||||
app.add_middleware(
|
||||
CORSMiddleware,
|
||||
allow_origins=["http://localhost:8001"],
|
||||
allow_origins=settings.CORS_ORIGINS,
|
||||
allow_credentials=True,
|
||||
allow_methods=["*"],
|
||||
allow_headers=["*"],
|
||||
|
||||
Reference in New Issue
Block a user