feat(server): supply YouTube cookies to the API container via .env

Set YTDLP_COOKIES_HOST in server/.env and compose mounts the host
cookies.txt read-only at /cookies.txt and wires YTDLP_COOKIES
automatically — no compose edits per host. Falls back to /dev/null when
unset so the container still starts. Add server/.env.example, gitignore
server/.env, and document the flow.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This commit is contained in:
2026-07-05 19:33:36 -07:00
parent 82bc524155
commit fc2d082a25
4 changed files with 31 additions and 11 deletions

View File

@@ -13,10 +13,14 @@ services:
MUSICFETCH_API_KEY: "${MUSICFETCH_API_KEY}"
MUSICFETCH_ROOT: "/media/music"
MUSICFETCH_PORT: "6769"
# Optional: authenticated YouTube cookies to avoid bot-check / rate limits.
# Mount a cookies.txt below and point this at it (in-container path).
YTDLP_COOKIES: "${YTDLP_COOKIES:-}"
# Optional: authenticated YouTube cookies to avoid bot-check ("Sign in to
# confirm you're not a bot") / rate limits. To enable, set in a .env file
# (see server/.env.example):
# YTDLP_COOKIES_HOST=/host/path/cookies.txt
# The host file is mounted read-only at /cookies.txt and used automatically.
YTDLP_COOKIES: "${YTDLP_COOKIES_HOST:+/cookies.txt}"
volumes:
- /media/music:/media/music
# Uncomment and set host path to supply cookies (see YTDLP_COOKIES above):
# - /path/to/cookies.txt:/cookies.txt:ro
# Cookies bind: maps to the host cookies.txt when YTDLP_COOKIES_HOST is set,
# otherwise /dev/null (harmless no-op so the container still starts).
- "${YTDLP_COOKIES_HOST:-/dev/null}:/cookies.txt:ro"