sample Docker/-compose file

This commit is contained in:
matthias@matsewe.de
2024-07-02 13:51:19 +02:00
parent dbaf0c5e4c
commit b48a27b2a3
5 changed files with 36 additions and 3 deletions

View File

@@ -19,7 +19,7 @@ from starlette.middleware import Middleware
from starlette_context import context, plugins
from starlette_context.middleware import RawContextMiddleware
if os.path.isfile("first_run") and (os.environ.get("RELOAD_ON_FIRST_RUN").lower() == "true"):
if os.path.isfile("first_run") and (os.environ.get("RELOAD_ON_FIRST_RUN", "").lower() == "true"):
print("First run ... load data")
with SessionLocal() as db:
asyncio.run(admin.create_upload_file(include_non_singable=True, db=db))

View File

@@ -11,7 +11,7 @@ import os
# openssl rand -hex 32
scopes_db = {
os.environ['ADMIN_EMAIL'] : ["admin"]
os.environ.get('ADMIN_EMAIL', "") : ["admin"]
}
credentials_exception = HTTPException(
@@ -22,6 +22,10 @@ credentials_exception = HTTPException(
async def get_current_user(
security_scopes: SecurityScopes, request: Request
):
if os.environ.get("NO_LOGIN", "").lower() == "true":
return {"sub": "test"}
try:
username: str = request.headers.get("x-auth-request-user") # type: ignore
if username is None: