Loads the configuration file and the configuration file schema, validates the configuration file, and creates a configuration object.
()
| 300 | |
| 301 | |
| 302 | def load_config() -> Configuration: |
| 303 | """ |
| 304 | Loads the configuration file and the configuration file schema, |
| 305 | validates the configuration file, and creates a configuration object. |
| 306 | """ |
| 307 | with open(SETTINGS.config_file_path, "r") as f: |
| 308 | config_data = yaml.safe_load(f) |
| 309 | |
| 310 | schema_path = os.path.join(pathlib.Path(__file__).parent.resolve(), "conf_yaml_schema.json") |
| 311 | |
| 312 | with open(schema_path, "r") as f: |
| 313 | schema = json.load(f) |
| 314 | config: dict[str, Any] = warlock.model_factory(schema, name="_Config")(config_data) |
| 315 | config_obj: Configuration = Configuration.from_dict(dict(config)) |
| 316 | return config_obj |
| 317 | |
| 318 | |
| 319 | CONFIGURATION = load_config() |
no test coverage detected