summaryrefslogtreecommitdiff
path: root/Biz/PodcastItLater/Web.py
diff options
context:
space:
mode:
authorBen Sima <ben@bsima.me>2025-09-03 16:46:30 -0400
committerBen Sima (aider) <ben@bsima.me>2025-09-03 16:46:30 -0400
commit48fdb6610957d213739f2cc84bc4c9071be909ac (patch)
treeff96a5ee3a538aac08a4f953af8d207cd419ae4e /Biz/PodcastItLater/Web.py
parent784aa0f3846d820212a5610d2f559f7749ecb2a0 (diff)
Add Environment-Aware Database Path Handling
Diffstat (limited to 'Biz/PodcastItLater/Web.py')
-rw-r--r--Biz/PodcastItLater/Web.py15
1 files changed, 13 insertions, 2 deletions
diff --git a/Biz/PodcastItLater/Web.py b/Biz/PodcastItLater/Web.py
index b471a29..86b2099 100644
--- a/Biz/PodcastItLater/Web.py
+++ b/Biz/PodcastItLater/Web.py
@@ -50,7 +50,14 @@ from typing import override
logger = Log.setup()
# Configuration
-DATABASE_PATH = os.getenv("DATABASE_PATH", "podcast.db")
+area = App.from_env()
+if area == App.Area.Test:
+ DATABASE_PATH = os.getenv(
+ "DATABASE_PATH",
+ "_/var/podcastitlater/podcast.db",
+ )
+else:
+ DATABASE_PATH = os.getenv("DATABASE_PATH", "/var/podcastitlater/podcast.db")
BASE_URL = os.getenv("BASE_URL", "http://localhost:8000")
PORT = int(os.getenv("PORT", "8000"))
@@ -1751,7 +1758,11 @@ class BaseWebTest(Test.TestCase):
def setUp(self) -> None:
"""Set up test database and client."""
# Create a test database context
- self.test_db_path = "test_podcast_web.db"
+ self.test_db_path = "_/var/podcastitlater/test_podcast_web.db"
+
+ # Ensure test directory exists
+ test_db_dir = pathlib.Path(self.test_db_path).parent
+ test_db_dir.mkdir(parents=True, exist_ok=True)
# Save original database path
self._original_db_path = globals()["_test_database_path"]