feat: Add environment configuration files and update settings for production and development
Some checks failed
Backend CI / lint (push) Failing after 5m0s
Backend CI / test (push) Successful in 3m39s

This commit is contained in:
JSC
2025-08-09 14:43:20 +02:00
parent 69544b6bb8
commit 734521c5c3
9 changed files with 202 additions and 11 deletions

View File

@@ -207,14 +207,14 @@ async def logout(
httponly=True,
secure=settings.COOKIE_SECURE,
samesite=settings.COOKIE_SAMESITE,
domain="localhost", # Match the domain used when setting cookies
domain=settings.COOKIE_DOMAIN, # Match the domain used when setting cookies
)
response.delete_cookie(
key="refresh_token",
httponly=True,
secure=settings.COOKIE_SECURE,
samesite=settings.COOKIE_SAMESITE,
domain="localhost", # Match the domain used when setting cookies
domain=settings.COOKIE_DOMAIN, # Match the domain used when setting cookies
)
return {"message": "Successfully logged out"}
@@ -303,7 +303,7 @@ async def oauth_callback(
"created_at": time.time(),
}
redirect_url = f"http://localhost:8001/auth/callback?code={temp_code}"
redirect_url = f"{settings.FRONTEND_URL}/auth/callback?code={temp_code}"
logger.info("Redirecting to: %s", redirect_url)
return RedirectResponse(

View File

@@ -1,6 +1,7 @@
"""Main router for v1 endpoints."""
from fastapi import APIRouter
from fastapi.responses import HTMLResponse
from app.core.logging import get_logger
from app.schemas.common import HealthResponse
@@ -15,3 +16,69 @@ def health() -> HealthResponse:
"""Health check endpoint."""
logger.info("Health check endpoint accessed")
return HealthResponse(status="healthy")
@router.get("/scalar-docs", response_class=HTMLResponse)
def scalar_docs() -> HTMLResponse:
"""Serve the API documentation using Scalar."""
return """
<!doctype html>
<html>
<head>
<title>API Documentation - Scalar</title>
<meta charset="utf-8" />
<meta name="viewport" content="width=device-width, initial-scale=1" />
</head>
<body>
<script
id="api-reference"
data-url="http://localhost:8000/api/openapi.json"
src="https://cdn.jsdelivr.net/npm/@scalar/api-reference"></script>
</body>
</html>
"""
@router.get("/rapidoc-docs", response_class=HTMLResponse)
async def rapidoc() -> HTMLResponse:
"""Serve the API documentation using Rapidoc."""
return """
<!doctype html>
<html>
<head>
<title>API Documentation - Rapidoc</title>
<meta charset="utf-8">
<script type="module" src="https://unpkg.com/rapidoc/dist/rapidoc-min.js"></script>
</head>
<body>
<rapi-doc
spec-url="http://localhost:8000/api/openapi.json"
theme="dark"
render-style="read">
</rapi-doc>
</body>
</html>
"""
@router.get("/elements-docs", response_class=HTMLResponse)
async def elements_docs() -> HTMLResponse:
"""Serve the API documentation using Stoplight Elements."""
return """
<!doctype html>
<html lang="en">
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">
<title>API Documentation - elements</title>
<script src="https://unpkg.com/@stoplight/elements/web-components.min.js"></script>
<link rel="stylesheet" href="https://unpkg.com/@stoplight/elements/styles.min.css">
</head>
<body>
<elements-api
apiDescriptionUrl="http://localhost:8000/api/openapi.json"
router="hash"
/>
</body>
</html>
"""