import os
import importlib

# 数据库配置
MONGO_URI = "mongodb://localhost:27017"
MONGO_DB_NAME = "kemeng_media"
# MONGO_URI = "mongodb://mongouser:Jdei2243afN@172.16.0.6:27017,172.16.0.4:27017/test?replicaSet=cmgo-r6qkaern_0&authSource=admin"
# MONGO_DB_NAME = "kemeng_media"

# 应用配置
APP_ENV = os.getenv('APP_ENV', 'development')
DEBUG = APP_ENV == 'development'

# 日志配置
LOG_LEVEL = 'INFO'
LOG_DIR = 'logs'

# 定时器配置
SCHEDULER_TIME = "24:00"  # 定时器执行时间，格式为 HH:MM (24小时制)

# TOS/火山云对象存储配置
TOS_CONFIG = {
    'access_key_id': os.getenv('TOS_ACCESS_KEY_ID', 'AKLTYjQyYmE1ZDAwZTY5NGZiOWI3ODZkZDhhOWE4MzVjODE'),
    'access_key_secret': os.getenv('TOS_ACCESS_KEY_SECRET', 'WlRKa05EbGhZVEUyTXpjNU5ESmpPRGt5T0RJNFl6QmhPR0pqTVRjMVpUWQ=='),
    'endpoint': 'https://tos-cn-beijing.volces.com',
    'region': 'cn-beijing',
    'bucket_name': os.getenv('TOS_BUCKET_NAME', 'km1'),
    'self_domain': os.getenv('TOS_SELF_DOMAIN', 'oss.xintiao85.com'),
    'disable_ssl_warnings': True
}

# API配置（兼容现有代码）
API_CONFIG = {
    'huoshan': {
        'AccessKey': TOS_CONFIG['access_key_id'],
        'SecretKey': TOS_CONFIG['access_key_secret']
    },
    'OSS_BUCKET_NAME': TOS_CONFIG['bucket_name'],
    'OSS_HOST': TOS_CONFIG['self_domain']
}

print(f"Successfully loaded configuration for environment: {APP_ENV}")