Files
wtf-backend/app/config.py
T

45 lines
1.3 KiB
Python

from pydantic_settings import BaseSettings
from typing import List
class Settings(BaseSettings):
PROJECT_NAME: str = "WTFX Backend API"
VERSION: str = "2.0.0"
DEBUG: bool = False
# 环境:development, staging, production
ENVIRONMENT: str = "development"
# 数据库配置 (PostgreSQL)
DATABASE_URL: str = "postgresql+asyncpg://postgres:postgres@localhost:5432/wtfx"
# Redis 配置
REDIS_URL: str = "redis://localhost:6379/0"
# JWT 鉴权
JWT_SECRET: str = "wtfx_secret_jwt_key_change_in_production"
JWT_ALGORITHM: str = "HS256"
ACCESS_TOKEN_EXPIRE_MINUTES: int = 60 * 24 * 7 # 7 days
# 跨域设置
CORS_ORIGINS: List[str] = [
"http://localhost:3000",
"http://localhost:3001",
"https://wtfx.app",
"https://test.wtfx.app",
"https://admin.wtfx.app",
"https://admin.test.wtfx.app"
]
# 链上 RPC 配置 (Robinhood Chain)
ROBINHOOD_TESTNET_RPC: str = "https://rpc.testnet.chain.robinhood.com"
ROBINHOOD_MAINNET_RPC: str = "https://rpc.chain.robinhood.com"
# 控制器合约地址 (由部署脚本生成)
CONTROLLER_ADDRESS: str = "0x0000000000000000000000000000000000000000"
class Config:
env_file = ".env"
case_sensitive = True
settings = Settings()