From 6fbd7471f7fa9be7b8af0e6d47bb380f3b92a771 Mon Sep 17 00:00:00 2001 From: Guillaume Duveau Date: Wed, 3 Dec 2025 00:36:16 +0100 Subject: [PATCH 1/2] remove DB_PATH, use named volumes --- README.md | 16 ++++++---------- app/services/cache.py | 3 ++- 2 files changed, 8 insertions(+), 11 deletions(-) diff --git a/README.md b/README.md index e9b3614..2daf58f 100644 --- a/README.md +++ b/README.md @@ -32,19 +32,15 @@ services: restart: unless-stopped ports: - "8000:8000" - environment: - # Database path inside the container - - DB_PATH=/app/data/whois_cache.db + ports: + - "8000:8000" volumes: # Data persistence (WHOIS cache) - - ./gptkit_data:/app/data -``` + - gptkit_data:/app/data -### Environment Variables - -| Variable | Description | Default | -|----------|-------------|--------| -| `DB_PATH` | Path to the SQLite database file | `whois_cache.db` | +volumes: + gptkit_data: +``` ## Development diff --git a/app/services/cache.py b/app/services/cache.py index abb2478..40787c8 100644 --- a/app/services/cache.py +++ b/app/services/cache.py @@ -6,7 +6,8 @@ class WhoisCache: def __init__(self, db_path: str = None): - self.db_path = db_path or os.getenv("DB_PATH", "whois_cache.db") + self.db_path = db_path or os.getenv("DB_PATH", "data/whois_cache.db") + os.makedirs(os.path.dirname(self.db_path), exist_ok=True) self._init_db() def _init_db(self): From 542d25cbe59a905446398cb0eba696f1022a1503 Mon Sep 17 00:00:00 2001 From: Guillaume Duveau Date: Wed, 3 Dec 2025 00:57:29 +0100 Subject: [PATCH 2/2] db_path removal --- README.md | 4 +--- app/services/cache.py | 4 ++-- 2 files changed, 3 insertions(+), 5 deletions(-) diff --git a/README.md b/README.md index 2daf58f..03769e2 100644 --- a/README.md +++ b/README.md @@ -30,12 +30,10 @@ services: gptkit: image: ghcr.io/your-username/gptkit:latest restart: unless-stopped - ports: - - "8000:8000" ports: - "8000:8000" volumes: - # Data persistence (WHOIS cache) + # Data persistence (WHOIS cache stored in /app/data/whois_cache.db) - gptkit_data:/app/data volumes: diff --git a/app/services/cache.py b/app/services/cache.py index 40787c8..7043499 100644 --- a/app/services/cache.py +++ b/app/services/cache.py @@ -5,8 +5,8 @@ import os class WhoisCache: - def __init__(self, db_path: str = None): - self.db_path = db_path or os.getenv("DB_PATH", "data/whois_cache.db") + def __init__(self): + self.db_path = "data/whois_cache.db" os.makedirs(os.path.dirname(self.db_path), exist_ok=True) self._init_db()