Files
gsfdc/server/app/core/config.py
T
wuzilongandCursor 9c7c80e194 feat: 把估价智能体和部署配置提交到主分支
门户估价对话、会员与智能体账号,以及生产 Docker 部署一直停在工作区,远端主分支还没有这些改动。

Co-authored-by: Cursor <cursoragent@cursor.com>
2026-11-23 09:42:44 +08:00

71 lines
2.4 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 = ""
# 浏览器能打开的 MinIO 主机名,只用于私有文件的签名链接。空则与 minio_endpoint 相同。
minio_public_endpoint: str = ""
minio_public_secure: bool = True
# 置于反向代理之后时,用 X-Forwarded-For 的第一段作为访客地址。
trust_proxy: bool = False
expose_docs: bool = True
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
# Dify console SSO bridge (demo). Shared HMAC secret with demo-dify GSREA_SSO_SECRET.
dify_public_url: str = "http://127.0.0.1:13080"
dify_sso_secret: str = ""
dify_sso_email_domain: str = "gsrea.local"
dify_sso_ttl_sec: int = 90
dify_api_base: str = "http://127.0.0.1:13080/v1"
dify_valuation_api_key: str = ""
valuation_admin_emails: str = ""
@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()