import json import os from fastapi import HTTPException def load_client_config(client_secret_path: str = None): if client_secret_path is None: base_dir = os.path.dirname(os.path.dirname(os.path.abspath(__file__))) client_secret_path = os.path.join(base_dir, "client_secret.json") try: with open(client_secret_path, "r") as f: return json.load(f) except FileNotFoundError: raise HTTPException(500, f"client_secret.json 파일을 찾을 수 없습니다. 경로: {client_secret_path}") except json.JSONDecodeError: raise HTTPException(500, f"client_secret.json 형식 오류. 경로: {client_secret_path}")