Fix database path resolution for Docker
This commit is contained in:
@@ -5,12 +5,14 @@ from pydantic_settings import BaseSettings, SettingsConfigDict
|
||||
|
||||
|
||||
def _resolve_db_url(url: str) -> str:
|
||||
"""Convert relative sqlite path to absolute path."""
|
||||
"""Convert relative sqlite path to absolute path for Docker or local dev."""
|
||||
if url.startswith("sqlite+aiosqlite:///./"):
|
||||
# Convert relative path to absolute
|
||||
# Convert relative path to absolute (works in both local and Docker)
|
||||
rel_path = url.replace("sqlite+aiosqlite:///./", "")
|
||||
abs_path = Path("/root/.openclaw/workspace-orchestrator/backend").resolve() / rel_path
|
||||
return f"sqlite+aiosqlite:///{abs_path}"
|
||||
# Use working directory as base
|
||||
base_dir = Path.cwd()
|
||||
abs_path = base_dir / rel_path
|
||||
return f"sqlite+aiosqlite:///{abs_path.resolve()}"
|
||||
return url
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user