| 635 | |
| 636 | |
| 637 | async 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 | |
| 659 | async def reset_env_to_example( |