Fix database path issue to ensure write permissions
This commit is contained in:
parent
e263239cee
commit
d458c80e8f
@ -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
|
||||
|
Loading…
x
Reference in New Issue
Block a user