feat: add a method to load configuration
This commit is contained in:
@@ -52,3 +52,10 @@ class Configuration:
|
|||||||
yaml.dump(config_data, f, default_flow_style=False)
|
yaml.dump(config_data, f, default_flow_style=False)
|
||||||
|
|
||||||
print(f"\nConfiguration saved to {self.config_file}")
|
print(f"\nConfiguration saved to {self.config_file}")
|
||||||
|
|
||||||
|
def load(self) -> dict:
|
||||||
|
if not self.exists():
|
||||||
|
raise FileNotFoundError(
|
||||||
|
f"Configuration file not found: {self.config_file}")
|
||||||
|
with open(self.config_file, "r") as f:
|
||||||
|
return yaml.safe_load(f)
|
||||||
|
|||||||
Reference in New Issue
Block a user