Files
gsfdc/server/app/core/config.py
T
wuzilongandCursor 608afb88ea chore: 同步主分支本地改动与个人开发工具链
纳入 personal-dev/OpenSpec 配置、管理端与教育 Demo 界面调整、工作人员 JWT 默认 7 天,以及参考资料与代理文档更新。

Co-authored-by: Cursor <cursoragent@cursor.com>
2026-11-10 17:14:52 +08:00

57 lines
1.7 KiB
Python

from functools import lru_cache
from pydantic_settings import BaseSettings, SettingsConfigDict
class Settings(BaseSettings):
model_config = SettingsConfigDict(env_file=".env", extra="ignore")
app_name: str = "甘肃省房地产价格评估行业协会"
cors_origins: str = (
"http://127.0.0.1:13000,http://localhost:13000,"
"http://127.0.0.1:13006,http://localhost:13006"
)
jwt_secret: str = ""
# 工作人员与门户会员令牌默认均 7 天。
jwt_expire_minutes: int = 10080
jwt_member_expire_minutes: int = 10080
api_payload_encrypt: bool = False
api_payload_aes_key: str = ""
api_ip_blacklist: str = ""
database_url: str = ""
redis_host: str = "127.0.0.1"
redis_port: int = 6379
redis_db: int = 0
redis_password: str = ""
redis_timeout_sec: int = 30
redis_ssl_enabled: bool = False
minio_endpoint: str = ""
minio_access_key: str = ""
minio_secret_key: str = ""
minio_bucket_public: str = "gsfdc-public"
minio_bucket_private: str = "gsfdc-private"
minio_secure: bool = False
minio_base_url: str = ""
field_aes_key: str = ""
gaode_key: str = ""
gaode_security_js_code: str = ""
smtp_host: str = ""
smtp_port: int = 465
smtp_user: str = ""
smtp_password: str = ""
smtp_sender: str = ""
smtp_use_ssl: bool = True
@property
def cors_origin_list(self) -> list[str]:
return [item.strip() for item in self.cors_origins.split(",") if item.strip()]
@property
def blocked_ips(self) -> set[str]:
return {item.strip() for item in self.api_ip_blacklist.split(",") if item.strip()}
@lru_cache
def get_settings() -> Settings:
return Settings()