22 lines
671 B
Python
22 lines
671 B
Python
import yaml
|
|
import os
|
|
|
|
|
|
class Config:
|
|
def __init__(self, config_path="config/settings.yaml"):
|
|
self.config_path = config_path
|
|
self.settings = self.load_config()
|
|
|
|
def load_config(self):
|
|
if not os.path.exists(self.config_path):
|
|
raise FileNotFoundError(f"Config file not found at {self.config_path}")
|
|
with open(self.config_path, "r") as f:
|
|
return yaml.safe_load(f)
|
|
|
|
def get(self, section, key, default=None):
|
|
return self.settings.get(section, {}).get(key, default)
|
|
|
|
def get_instances(self):
|
|
"""Return the list of Odoo instances."""
|
|
return self.settings.get("odoo_instances", [])
|