Files
gsfdc/server/app/core/config.py
T
wuzilongandCursor 60158935f4 feat(admin): 从管理端免登打开 Dify 控制台
工作人员经一次性跳转进入本地 Dify。AI 智能体菜单去掉已停用项,文件页工具栏收进表头,并关闭快速入口。

Co-authored-by: Cursor <cursoragent@cursor.com>
2026-11-18 13:58:40 +08:00

62 lines
1.9 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
# 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
@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()