fix(oauth): fallback storage path for CI and local dev

Both JSONStorage and ClientRegistry now use ./data when /app doesn't
exist (Docker vs local/CI environments).

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
airano
2026-02-17 18:32:44 +03:30
parent c619089403
commit 0aefc29dee
2 changed files with 11 additions and 5 deletions

View File

@@ -13,6 +13,9 @@ from .schemas import OAuthClient
logger = logging.getLogger(__name__)
# Default data directory: /app/data in Docker, ./data elsewhere
_DEFAULT_DATA_DIR = "/app/data" if Path("/app").exists() else "./data"
class ClientRegistry:
"""
@@ -21,7 +24,8 @@ class ClientRegistry:
Storage: data/oauth_clients.json
"""
def __init__(self, data_dir: str = "/app/data"):
def __init__(self, data_dir: str | None = None):
data_dir = data_dir or _DEFAULT_DATA_DIR
self.data_dir = Path(data_dir)
self.data_dir.mkdir(parents=True, exist_ok=True)