From 05704fcb904befb78910416dc7bba982d400cb90 Mon Sep 17 00:00:00 2001 From: Cursor Agent Date: Mon, 22 Dec 2025 21:21:33 +0000 Subject: [PATCH] Docs: Add more .env options and python server details Co-authored-by: mathieumoran1 --- README.md | 19 +++++++++++++++++++ python_video_server/README.md | 19 +++++++++++++++++++ 2 files changed, 38 insertions(+) diff --git a/README.md b/README.md index bf10323..151b7a3 100644 --- a/README.md +++ b/README.md @@ -53,3 +53,22 @@ This app uses **MongoDB** via Mongoose. Provide a connection string in `MONGO_UR - Atlas: `mongodb+srv://USER:PASS@cluster0.XXXX.mongodb.net/?retryWrites=true&w=majority` - Local: `mongodb://127.0.0.1:27017/` - Collections are created/managed automatically from the models in `models/` (e.g. `User`, `Movie`, `Setting`, `PlaybackProgress`). + +## More `.env` options +The app also reads these environment variables (all optional): + +```bash +PORT=5000 # server port (default: 5000) +JWT_EXPIRES_IN=8h # JWT expiry (default: 8h) +VIDEO_FILES_DIR=/abs/path/to/video # where server video files live (default: ./public/video) +VIDEO_SESSION_MAX_AGE_SECONDS=28800 # video_auth cookie max-age (default: 8h) +MOVIES_CACHE_TTL_MS=30000 # movies route cache TTL (default: 30000ms) +``` + +## Python video server (optional) +There is also a standalone Python server in `python_video_server/` that mirrors `/api/video/:id` (Range streaming + JWT + Mongo). +See `python_video_server/README.md` for full instructions. In addition to `MONGO_URI` and `JWT_SECRET`, you may need: + +```bash +export MONGO_DB_NAME="oscars-pool" # if your MONGO_URI doesn't include a / path +``` diff --git a/python_video_server/README.md b/python_video_server/README.md index 54d0eba..cf6151f 100644 --- a/python_video_server/README.md +++ b/python_video_server/README.md @@ -11,12 +11,31 @@ This is a small standalone server that mirrors the app’s `/api/video/:id` beha ```bash python -m pip install -r python_video_server/requirements.txt export MONGO_URI="..." +export MONGO_DB_NAME="..." # optional; required if MONGO_URI doesn't include / export JWT_SECRET="..." export VIDEO_FILES_DIR="/absolute/path/to/public/video" # optional (default: ./public/video) export VIDEO_SESSION_MAX_AGE_SECONDS="28800" # optional (default: 8h) uvicorn python_video_server.server:app --host 0.0.0.0 --port 8000 ``` +## Extra environment variables (optional) + +```bash +# CORS (needed when the main app is on a different origin) +export CORS_ALLOW_ORIGINS="https://your-app.example.com" # default: "*" + +# Cookie behavior for /api/video/session +export VIDEO_COOKIE_SAMESITE="Lax" # Lax|Strict|None (default: Lax) + +# Mongo TLS / connectivity troubleshooting (Atlas, weird hosts, etc.) +export MONGO_TLS_CA_FILE="/path/to/ca.pem" # prefer a valid CA bundle +export MONGO_TLS_FORCE_TLS12="1" # force TLS 1.2 if TLS 1.3 breaks +export MONGO_TLS_INSECURE="1" # NOT recommended; debug only +export MONGO_SERVER_SELECTION_TIMEOUT_MS="8000" +export MONGO_CONNECT_TIMEOUT_MS="8000" +export MONGO_SOCKET_TIMEOUT_MS="20000" +``` + ## HTTPS (Let’s Encrypt, Python-only) This server can be served over HTTPS by running `uvicorn` with `--ssl-certfile` and `--ssl-keyfile`. -- 2.54.0