NextERP-scripts/services/config.py
2025-04-03 15:33:38 +07:00

21 lines
672 B
Python

import os
import yaml
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", [])