40 lines
1.1 KiB
Python
40 lines
1.1 KiB
Python
#!/usr/bin/env python3
|
|
"""
|
|
Configuration for YouTube Thumbnail Watcher Service
|
|
"""
|
|
|
|
import os
|
|
from dotenv import load_dotenv
|
|
|
|
# Load environment variables
|
|
load_dotenv()
|
|
|
|
# Directus Configuration
|
|
DIRECTUS_URL = os.getenv("DIRECTUS_URL", "https://enias.zeabur.app/")
|
|
DIRECTUS_TOKEN = os.getenv("DIRECTUS_TOKEN")
|
|
|
|
# YouTube API (optional - fallback works without it)
|
|
YOUTUBE_API_KEY = os.getenv("YOUTUBE_API_KEY")
|
|
|
|
# Service Configuration
|
|
POLL_INTERVAL = int(os.getenv("POLL_INTERVAL", "30")) # seconds
|
|
BATCH_SIZE = int(os.getenv("BATCH_SIZE", "10")) # items per batch
|
|
LOG_LEVEL = os.getenv("LOG_LEVEL", "INFO")
|
|
|
|
# Validation
|
|
if not DIRECTUS_TOKEN:
|
|
raise ValueError("DIRECTUS_TOKEN environment variable is required")
|
|
|
|
if not DIRECTUS_URL.endswith('/'):
|
|
DIRECTUS_URL += '/'
|
|
|
|
# API endpoints
|
|
DIRECTUS_ITEMS_URL = f"{DIRECTUS_URL}items"
|
|
DIRECTUS_FILES_URL = f"{DIRECTUS_URL}files"
|
|
|
|
print(f"Configuration loaded:")
|
|
print(f" Directus URL: {DIRECTUS_URL}")
|
|
print(f" Has Directus Token: {bool(DIRECTUS_TOKEN)}")
|
|
print(f" Has YouTube API Key: {bool(YOUTUBE_API_KEY)}")
|
|
print(f" Poll Interval: {POLL_INTERVAL}s")
|
|
print(f" Batch Size: {BATCH_SIZE}") |