40 lines
1002 B
Python
40 lines
1002 B
Python
"""配置管理"""
|
||
import os
|
||
from functools import lru_cache
|
||
from pydantic_settings import BaseSettings
|
||
|
||
|
||
class Settings(BaseSettings):
|
||
"""应用配置"""
|
||
# 应用信息
|
||
APP_NAME: str = "000-platform"
|
||
APP_VERSION: str = "0.1.0"
|
||
DEBUG: bool = False
|
||
|
||
# 数据库
|
||
DATABASE_URL: str = "mysql+pymysql://scrm_reader:ScrmReader2024Pass@47.107.71.55:3306/new_qiqi"
|
||
|
||
# API Key(内部服务调用)
|
||
API_KEY: str = "platform_api_key_2026"
|
||
|
||
# 管理员账号
|
||
ADMIN_USERNAME: str = "admin"
|
||
ADMIN_PASSWORD_HASH: str = "" # bcrypt hash
|
||
|
||
# JWT
|
||
JWT_SECRET: str = "platform_jwt_secret_2026_change_in_prod"
|
||
JWT_ALGORITHM: str = "HS256"
|
||
JWT_EXPIRE_HOURS: int = 24
|
||
|
||
# 配置加密密钥
|
||
CONFIG_ENCRYPT_KEY: str = "platform_config_key_32bytes!!"
|
||
|
||
class Config:
|
||
env_file = ".env"
|
||
extra = "ignore"
|
||
|
||
|
||
@lru_cache()
|
||
def get_settings() -> Settings:
|
||
return Settings()
|