123
This commit is contained in:
56
backend/signin_executor/app/config.py
Normal file
56
backend/signin_executor/app/config.py
Normal file
@@ -0,0 +1,56 @@
|
||||
"""
|
||||
Configuration for Sign-in Executor Service
|
||||
"""
|
||||
|
||||
import os
|
||||
from pydantic_settings import BaseSettings
|
||||
|
||||
class Settings(BaseSettings):
|
||||
"""Sign-in Executor settings"""
|
||||
|
||||
# Server settings
|
||||
HOST: str = os.getenv("HOST", "0.0.0.0")
|
||||
PORT: int = int(os.getenv("PORT", 8000))
|
||||
DEBUG: bool = os.getenv("DEBUG", "False").lower() == "true"
|
||||
|
||||
# Database settings
|
||||
DATABASE_URL: str = os.getenv(
|
||||
"DATABASE_URL",
|
||||
"mysql+aiomysql://weibo:123456789@118.195.133.163/weibo"
|
||||
)
|
||||
REDIS_URL: str = os.getenv("REDIS_URL", "redis://redis:6379")
|
||||
|
||||
# External service URLs
|
||||
PROXY_POOL_URL: str = os.getenv("PROXY_POOL_URL", "http://proxy-pool:8080")
|
||||
BROWSER_AUTOMATION_URL: str = os.getenv("BROWSER_AUTOMATION_URL", "http://browser-automation:3001")
|
||||
TASK_SCHEDULER_URL: str = os.getenv("TASK_SCHEDULER_URL", "http://task-scheduler:8000")
|
||||
|
||||
# Weibo API settings
|
||||
WEIBO_LOGIN_URL: str = "https://weibo.com/login.php"
|
||||
WEIBO_SUPER_TOPIC_URL: str = "https://weibo.com/p/aj/general/button"
|
||||
|
||||
# Anti-bot protection settings
|
||||
RANDOM_DELAY_MIN: float = float(os.getenv("RANDOM_DELAY_MIN", "1.0"))
|
||||
RANDOM_DELAY_MAX: float = float(os.getenv("RANDOM_DELAY_MAX", "3.0"))
|
||||
USER_AGENT_ROTATION: bool = os.getenv("USER_AGENT_ROTATION", "True").lower() == "true"
|
||||
|
||||
# Cookie and session settings
|
||||
COOKIE_ENCRYPTION_KEY: str = os.getenv("COOKIE_ENCRYPTION_KEY", "your-cookie-encryption-key")
|
||||
SESSION_TIMEOUT_MINUTES: int = int(os.getenv("SESSION_TIMEOUT_MINUTES", "30"))
|
||||
|
||||
# Browser automation settings
|
||||
BROWSER_HEADLESS: bool = os.getenv("BROWSER_HEADLESS", "True").lower() == "true"
|
||||
BROWSER_TIMEOUT_SECONDS: int = int(os.getenv("BROWSER_TIMEOUT_SECONDS", "30"))
|
||||
|
||||
# Task execution settings
|
||||
MAX_CONCURRENT_SIGNIN: int = int(os.getenv("MAX_CONCURRENT_SIGNIN", "5"))
|
||||
TASK_TIMEOUT_SECONDS: int = int(os.getenv("TASK_TIMEOUT_SECONDS", "300"))
|
||||
|
||||
# Logging
|
||||
LOG_LEVEL: str = os.getenv("LOG_LEVEL", "INFO")
|
||||
|
||||
class Config:
|
||||
case_sensitive = True
|
||||
env_file = ".env"
|
||||
|
||||
settings = Settings()
|
||||
Reference in New Issue
Block a user