Spaces:
Building
Building
import json | |
from pathlib import Path | |
from fastapi import Depends | |
CONFIG_FILE = Path("service_config.json") | |
class ServiceConfig: | |
def __init__(self): | |
with open(CONFIG_FILE, "r") as f: | |
self.data = json.load(f) | |
def get_current_project(self): | |
if not self.data['projects']: | |
raise ValueError("No projects configured") | |
# For simplicity, just return the first project | |
return self.data['projects'][0] | |
def get_config(): | |
return ServiceConfig() | |