TwitchDownloader/docker/entrypoint.sh

27 lines
650 B
Bash
Raw Permalink Normal View History

#!/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)