feat: enable OIDC export by default
This commit is contained in:
+6
-1
@@ -30,7 +30,7 @@ DEFAULT_CONFIG = {
|
|||||||
"grok2api_remote_base": "",
|
"grok2api_remote_base": "",
|
||||||
"grok2api_remote_app_key": "",
|
"grok2api_remote_app_key": "",
|
||||||
"api_reverse_tools": "",
|
"api_reverse_tools": "",
|
||||||
"cpa_export_enabled": False,
|
"cpa_export_enabled": True,
|
||||||
"cpa_auth_dir": "./cpa_auths",
|
"cpa_auth_dir": "./cpa_auths",
|
||||||
"cpa_copy_to_hotload": False,
|
"cpa_copy_to_hotload": False,
|
||||||
"cpa_hotload_dir": "",
|
"cpa_hotload_dir": "",
|
||||||
@@ -62,6 +62,7 @@ def _require_bool(cfg, key):
|
|||||||
raise ConfigError(f"配置项 {key} 必须是布尔值 true/false")
|
raise ConfigError(f"配置项 {key} 必须是布尔值 true/false")
|
||||||
return value
|
return value
|
||||||
|
|
||||||
|
|
||||||
def _require_int(cfg, key, minimum, maximum):
|
def _require_int(cfg, key, minimum, maximum):
|
||||||
value = cfg.get(key)
|
value = cfg.get(key)
|
||||||
if type(value) is not int:
|
if type(value) is not int:
|
||||||
@@ -70,6 +71,7 @@ def _require_int(cfg, key, minimum, maximum):
|
|||||||
raise ConfigError(f"配置项 {key} 必须在 {minimum} 到 {maximum} 之间")
|
raise ConfigError(f"配置项 {key} 必须在 {minimum} 到 {maximum} 之间")
|
||||||
return value
|
return value
|
||||||
|
|
||||||
|
|
||||||
def _require_string(cfg, key, path=False):
|
def _require_string(cfg, key, path=False):
|
||||||
value = cfg.get(key)
|
value = cfg.get(key)
|
||||||
if not isinstance(value, str):
|
if not isinstance(value, str):
|
||||||
@@ -81,6 +83,7 @@ def _require_string(cfg, key, path=False):
|
|||||||
os.path.expanduser(value)
|
os.path.expanduser(value)
|
||||||
return value
|
return value
|
||||||
|
|
||||||
|
|
||||||
def validate_config_structure(raw):
|
def validate_config_structure(raw):
|
||||||
if not isinstance(raw, dict):
|
if not isinstance(raw, dict):
|
||||||
raise ConfigError("config root must be a JSON object")
|
raise ConfigError("config root must be a JSON object")
|
||||||
@@ -141,6 +144,7 @@ def validate_config_structure(raw):
|
|||||||
cfg[key] = os.path.expanduser(value)
|
cfg[key] = os.path.expanduser(value)
|
||||||
return cfg
|
return cfg
|
||||||
|
|
||||||
|
|
||||||
def validate_run_requirements(cfg):
|
def validate_run_requirements(cfg):
|
||||||
cfg = validate_config_structure(cfg)
|
cfg = validate_config_structure(cfg)
|
||||||
provider = cfg["email_provider"]
|
provider = cfg["email_provider"]
|
||||||
@@ -166,6 +170,7 @@ def validate_run_requirements(cfg):
|
|||||||
raise ConfigError("启用 CPA 热加载复制时必须配置 cpa_hotload_dir")
|
raise ConfigError("启用 CPA 热加载复制时必须配置 cpa_hotload_dir")
|
||||||
return cfg
|
return cfg
|
||||||
|
|
||||||
|
|
||||||
def validate_config(raw):
|
def validate_config(raw):
|
||||||
"""Backward-compatible full validation used before a run or save."""
|
"""Backward-compatible full validation used before a run or save."""
|
||||||
return validate_run_requirements(raw)
|
return validate_run_requirements(raw)
|
||||||
|
|||||||
Reference in New Issue
Block a user