From d458c80e8fd8420ab45a3ad89819314f6ad90fbd Mon Sep 17 00:00:00 2001 From: Automated Action Date: Tue, 3 Jun 2025 18:05:59 +0000 Subject: [PATCH] Fix database path issue to ensure write permissions --- app/core/config.py | 13 +++---------- 1 file changed, 3 insertions(+), 10 deletions(-) diff --git a/app/core/config.py b/app/core/config.py index 6f08323..6e8151b 100644 --- a/app/core/config.py +++ b/app/core/config.py @@ -1,16 +1,9 @@ import os -import tempfile from pathlib import Path from pydantic import field_validator, BaseModel -# Get project root directory -if '/app/repo' in str(Path.cwd()): - # When running in the container, use a temporary directory - # This ensures we have write permissions - ROOT_DIR = Path(tempfile.gettempdir()) -else: - # When running in development - ROOT_DIR = Path(__file__).parent.parent.parent.resolve() +# Project directories +ROOT_DIR = Path(__file__).parent.parent.parent.resolve() class Settings(BaseModel): @@ -19,7 +12,7 @@ class Settings(BaseModel): API_V1_STR: str = "/api/v1" # Database - DB_DIR: Path = ROOT_DIR / "storage" / "db" + DB_DIR: Path = Path("/app") / "storage" / "db" SQLALCHEMY_DATABASE_URL: str = f"sqlite:///{DB_DIR}/db.sqlite" # Secret settings