"""配置：从环境变量 / .env 读取。"""
import os
from pydantic_settings import BaseSettings


class Settings(BaseSettings):
    jwt_secret: str = "change-me-to-a-long-random-string"
    jwt_algorithm: str = "HS256"
    jwt_expires_seconds: int = 3600
    database_url: str = "sqlite:///./pica.db"
    host: str = "0.0.0.0"
    port: int = 8000

    class Config:
        env_file = ".env"
        env_prefix = ""


settings = Settings()
# 防止使用默认弱密钥启动（生产环境）
if settings.jwt_secret.startswith("change-me"):
    # 仅警告，不阻断本地开发
    print("[WARN] JWT_SECRET 仍是默认值，请在 .env 中设置随机长串！")
