95def save_config(config: ControllerConfig, filepath: str) ->
None:
96 """Save controller configuration to file.
100 config : ControllerConfig
101 Configuration to save.
103 Path to save config file. Extension determines format (.json or .yaml).
105 path = Path(filepath)
106 suffix = path.suffix.lower()
108 if suffix ==
'.json':
109 config.to_json(str(path))
110 elif suffix
in [
'.yaml',
'.yml']:
111 config.to_yaml(str(path))
113 raise ValueError(f
"Unsupported config file format: {suffix}. Use .json or .yaml")