You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
43 lines
1.0 KiB
43 lines
1.0 KiB
|
2 months ago
|
import json
|
||
|
|
from typing import List
|
||
|
|
from pydantic_settings import BaseSettings
|
||
|
|
from functools import lru_cache
|
||
|
|
|
||
|
|
|
||
|
|
class Settings(BaseSettings):
|
||
|
|
APP_NAME: str = "A股智投后端服务"
|
||
|
|
APP_ENV: str = "development"
|
||
|
|
APP_DEBUG: bool = True
|
||
|
|
APP_HOST: str = "0.0.0.0"
|
||
|
|
APP_PORT: int = 8000
|
||
|
|
|
||
|
|
CORS_ORIGINS: str = '["http://localhost:5173","http://localhost:3000"]'
|
||
|
|
|
||
|
|
REDIS_URL: str = "redis://localhost:6379/0"
|
||
|
|
CACHE_TTL: int = 60
|
||
|
|
|
||
|
|
LOG_LEVEL: str = "INFO"
|
||
|
|
|
||
|
|
EASTMONEY_API: str = "https://push2.eastmoney.com"
|
||
|
|
THS_API: str = "https://q.10jqka.com.cn"
|
||
|
|
XUEQIU_API: str = "https://stock.xueqiu.com"
|
||
|
|
TENCENT_API: str = "https://web.sqt.gtimg.cn"
|
||
|
|
|
||
|
|
WS_HEARTBEAT_INTERVAL: int = 30
|
||
|
|
WS_RECONNECT_DELAY: int = 5
|
||
|
|
|
||
|
|
@property
|
||
|
|
def cors_origins_list(self) -> List[str]:
|
||
|
|
return json.loads(self.CORS_ORIGINS)
|
||
|
|
|
||
|
|
class Config:
|
||
|
|
env_file = ".env"
|
||
|
|
env_file_encoding = "utf-8"
|
||
|
|
|
||
|
|
|
||
|
|
@lru_cache()
|
||
|
|
def get_settings() -> Settings:
|
||
|
|
return Settings()
|
||
|
|
|
||
|
|
|
||
|
|
settings = get_settings()
|