Raiff1982 commited on
Commit
930c4b1
·
verified ·
1 Parent(s): 30d1e27

Create codriao_config_loader.py

Browse files
Files changed (1) hide show
  1. codriao_config_loader.py +28 -0
codriao_config_loader.py ADDED
@@ -0,0 +1,28 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+
2
+ import json
3
+ import os
4
+
5
+ class CodriaoConfig:
6
+ def __init__(self, config_path="config.json"):
7
+ self.config_path = config_path
8
+ self.settings = self.load_config()
9
+
10
+ def load_config(self):
11
+ if not os.path.exists(self.config_path):
12
+ raise FileNotFoundError(f"Configuration file {self.config_path} not found.")
13
+
14
+ with open(self.config_path, "r") as file:
15
+ return json.load(file)
16
+
17
+ def get(self, key, default=None):
18
+ keys = key.split(".")
19
+ value = self.settings
20
+ for k in keys:
21
+ value = value.get(k, {})
22
+ return value if value else default
23
+
24
+ # Example Usage:
25
+ if __name__ == "__main__":
26
+ config = CodriaoConfig()
27
+ print("AI Capabilities:", config.get("ai_capabilities"))
28
+ print("Security Settings:", config.get("security_settings"))