MCPcopy Create free account
hub / github.com/ZyphrZero/z.ai2api_python / save_source_config

Function save_source_config

app/admin/config_manager.py:637–656  ·  view source on GitHub ↗
(
    env_content: str,
    *,
    reload_callback: ReloadCallback,
    env_path: str | Path = ENV_PATH,
)

Source from the content-addressed store, hash-verified

635
636
637async def save_source_config(
638 env_content: str,
639 *,
640 reload_callback: ReloadCallback,
641 env_path: str | Path = ENV_PATH,
642) -> None:
643 normalized = validate_env_source(env_content)
644
645 def _writer(target_path: Path) -> None:
646 content = normalized.rstrip("\n")
647 target_path.write_text(
648 f"{content}\n" if content else "",
649 encoding="utf-8",
650 )
651
652 await _apply_env_change(
653 _writer,
654 reload_callback=reload_callback,
655 env_path=env_path,
656 )
657
658
659async def reset_env_to_example(

Calls 2

validate_env_sourceFunction · 0.85
_apply_env_changeFunction · 0.85