Files
wtf-backend/app/config.py
T

48 lines
1.5 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 = "0xc0E24E152771C588B21AEB654b30B1cBAf381c1a"
COLLATERAL_ADDRESS: str = "0xe776e957953EA69b7Eaa9d7d4098aBC076bDD5E7"
CURVE_ADDRESS: str = "0xF0E189974c413506098AFB6Bc6Bf4C6715fBf7B1"
class Config:
env_file = ".env"
case_sensitive = True
extra = "ignore"
settings = Settings()