TwitchDownloader/docker/entrypoint.sh
MaddoScientisto 708464bd86
All checks were successful
Publish Twitch Archive Container / publish (push) Successful in 1m24s
Refactor entrypoint script to use Python and streamline environment variable handling
Co-authored-by: Copilot <copilot@github.com>
2026-04-25 17:12:39 +02:00

27 lines
No EOL
650 B
Bash

#!/usr/bin/env python3
import os
import sys
from pathlib import Path
for path in ('/app/archive', '/app/config', '/app/bin/temp'):
Path(path).mkdir(parents=True, exist_ok=True)
env_aliases = {
'CLIENT-ID': 'CLIENT_ID',
'CLIENT-SECRET': 'CLIENT_SECRET',
'OAUTH-PRIVATE-TOKEN': 'OAUTH_PRIVATE_TOKEN',
}
for source_name, target_name in env_aliases.items():
source_value = os.environ.get(source_name)
if source_value and not os.environ.get(target_name):
os.environ[target_name] = source_value
if len(sys.argv) < 2:
raise SystemExit('twitch-archive-entrypoint requires a command to run')
os.execvpe(sys.argv[1], sys.argv[1:], os.environ)