MCPcopy Create free account
hub / github.com/Tron521/codex-console-temp / Settings

Class Settings

src/config/settings.py:770–913  ·  view source on GitHub ↗

应用配置 - 完全基于数据库存储

Source from the content-addressed store, hash-verified

768
769
770class Settings(BaseModel):
771 """
772 应用配置 - 完全基于数据库存储
773 """
774
775 # 应用信息
776 app_name: str = "OpenAI/Codex CLI 自动注册系统"
777 app_version: str = "1.1.2"
778 debug: bool = False
779
780 # 数据库配置
781 database_url: str = "data/database.db"
782
783 @field_validator('database_url', mode='before')
784 @classmethod
785 def validate_database_url(cls, v):
786 if isinstance(v, str):
787 if v.startswith(("postgres://", "postgresql://")):
788 return _normalize_database_url(v)
789 if v.startswith(("postgresql+psycopg://", "postgresql+psycopg2://")):
790 return v
791 if isinstance(v, str) and v.startswith("sqlite:///"):
792 return v
793 if isinstance(v, str) and not v.startswith(("sqlite:///", "postgresql://", "postgresql+psycopg://", "postgresql+psycopg2://", "mysql://")):
794 # 如果是文件路径,转换为 SQLite URL
795 if os.path.isabs(v) or ":/" not in v:
796 return f"sqlite:///{v}"
797 return v
798
799 # Web UI 配置
800 webui_host: str = "0.0.0.0"
801 webui_port: int = 8000
802 webui_secret_key: SecretStr = SecretStr("your-secret-key-change-in-production")
803 webui_access_password: SecretStr = SecretStr("admin123")
804 auto_quick_refresh_enabled: bool = False
805 auto_quick_refresh_interval_minutes: int = 30
806 auto_quick_refresh_retry_limit: int = 2
807 selfcheck_auto_enabled: bool = False
808 selfcheck_interval_minutes: int = 15
809 selfcheck_mode: str = "quick"
810 circuit_breaker_enabled: bool = True
811 circuit_breaker_failure_threshold: int = 5
812 circuit_breaker_cooldown_seconds: int = 180
813 circuit_breaker_probe_interval_seconds: int = 30
814
815 # 日志配置
816 log_level: str = "INFO"
817 log_file: str = "logs/app.log"
818 log_retention_days: int = 14
819
820 # OpenAI 配置
821 openai_client_id: str = "app_EMoamEEZ73f0CkXaXp7hrann"
822 openai_auth_url: str = "https://auth.openai.com/oauth/authorize"
823 openai_token_url: str = "https://auth.openai.com/oauth/token"
824 openai_redirect_uri: str = "http://localhost:1455/auth/callback"
825 openai_scope: str = "openid email profile offline_access"
826
827 # 代理配置

Calls

no outgoing calls