Spaces:
Runtime error
Runtime error
File size: 840 Bytes
930c4b1 |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 |
import json
import os
class CodriaoConfig:
def __init__(self, config_path="config.json"):
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"Configuration file {self.config_path} not found.")
with open(self.config_path, "r") as file:
return json.load(file)
def get(self, key, default=None):
keys = key.split(".")
value = self.settings
for k in keys:
value = value.get(k, {})
return value if value else default
# Example Usage:
if __name__ == "__main__":
config = CodriaoConfig()
print("AI Capabilities:", config.get("ai_capabilities"))
print("Security Settings:", config.get("security_settings"))
|