ciyidogan commited on
Commit
14b6ee2
·
verified ·
1 Parent(s): 1e8bcd7

Update config_provider.py

Browse files
Files changed (1) hide show
  1. config_provider.py +16 -4
config_provider.py CHANGED
@@ -1,7 +1,19 @@
1
- from service_config import ServiceConfig
 
 
2
 
3
- service_config = ServiceConfig()
4
- service_config.load()
 
 
 
 
 
 
 
 
 
 
5
 
6
  def get_config():
7
- return service_config
 
1
+ import json
2
+ from pathlib import Path
3
+ from fastapi import Depends
4
 
5
+ CONFIG_FILE = Path("service_config.json")
6
+
7
+ class ServiceConfig:
8
+ def __init__(self):
9
+ with open(CONFIG_FILE, "r") as f:
10
+ self.data = json.load(f)
11
+
12
+ def get_current_project(self):
13
+ if not self.data['projects']:
14
+ raise ValueError("No projects configured")
15
+ # For simplicity, just return the first project
16
+ return self.data['projects'][0]
17
 
18
  def get_config():
19
+ return ServiceConfig()