bug fixing
This commit is contained in:
@@ -98,6 +98,18 @@ class Config:
|
||||
"""Load configuration from YAML file and environment variables"""
|
||||
self.config_path = Path(config_path)
|
||||
|
||||
# If config.yaml doesn't exist, try config.yaml.example
|
||||
if not self.config_path.exists():
|
||||
example_path = Path(str(config_path) + ".example")
|
||||
if example_path.exists():
|
||||
raise FileNotFoundError(
|
||||
f"Config file '{config_path}' not found. "
|
||||
f"Copy '{example_path}' to '{config_path}' and edit it with your settings.\n"
|
||||
f"Run: cp {example_path} {config_path}"
|
||||
)
|
||||
else:
|
||||
raise FileNotFoundError(f"Config file '{config_path}' not found")
|
||||
|
||||
# Load YAML configuration
|
||||
with open(self.config_path) as f:
|
||||
self._config: dict[str, Any] = yaml.safe_load(f)
|
||||
|
||||
Reference in New Issue
Block a user