Skip to content

Commit e38cd65

Browse files
jeffcrouseclaude
andcommitted
fix: remove /data/music default - require explicit configuration
Previously, the code defaulted to /data/music if no music library path was configured. This caused issues when: 1. The path didn't exist 2. Multiple paths appeared to be valid due to symlinks/mounts 3. Scans started without proper user configuration Now there is NO default path - users must explicitly configure their music library via the admin UI (/admin) or MUSIC_LIBRARY_PATH env var. The app will show a clear warning if no path is configured. 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
1 parent 11e0305 commit e38cd65

File tree

3 files changed

+12
-8
lines changed

3 files changed

+12
-8
lines changed

backend/app/config.py

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,8 @@ class Settings(BaseSettings):
1616
redis_url: str = "redis://localhost:6379/0"
1717

1818
# Music library (comma-separated paths supported)
19-
music_library_path: str = "/data/music"
19+
# NOTE: No default - must be configured via admin UI or MUSIC_LIBRARY_PATH env var
20+
music_library_path: str = ""
2021

2122
@property
2223
def music_library_paths(self) -> list[Path]:
@@ -25,7 +26,10 @@ def music_library_paths(self) -> list[Path]:
2526
Priority:
2627
1. AppSettings (settings.json) if configured via admin UI
2728
2. Environment variable MUSIC_LIBRARY_PATH (comma-separated)
28-
3. Default /data/music
29+
3. Empty list (user must configure via /admin)
30+
31+
There is intentionally NO default path - the user must explicitly
32+
configure their music library location via the admin UI.
2933
"""
3034
# Check AppSettings first (configured via admin UI)
3135
from app.services.app_settings import get_app_settings_service
@@ -35,7 +39,7 @@ def music_library_paths(self) -> list[Path]:
3539
return [Path(p) for p in app_settings.music_library_paths if p]
3640

3741
# Fall back to environment variable (for backwards compatibility)
38-
if self.music_library_path and self.music_library_path != "/data/music":
42+
if self.music_library_path:
3943
paths = []
4044
for p in self.music_library_path.split(","):
4145
p = p.strip()
@@ -44,8 +48,8 @@ def music_library_paths(self) -> list[Path]:
4448
if paths:
4549
return paths
4650

47-
# Default
48-
return [Path("/data/music")]
51+
# No default - user must configure via admin UI
52+
return []
4953

5054
# Data paths
5155
art_path: Path = Path("data/art")

backend/app/main.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -90,8 +90,8 @@ def migrate_env_to_settings() -> None:
9090

9191
# Check for MUSIC_LIBRARY_PATH environment variable
9292
env_path = app_config.music_library_path
93-
if env_path and env_path != "/data/music":
94-
# User has a custom path configured via env var - migrate it
93+
if env_path:
94+
# User has a path configured via env var - migrate it to settings
9595
paths = [p.strip() for p in env_path.split(",") if p.strip()]
9696
if paths:
9797
service.update(music_library_paths=paths)

backend/tests/test_scanner.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -261,7 +261,7 @@ async def test_hash_matching_with_different_mount_paths(self, clean_db):
261261
262262
This simulates the real-world scenario where:
263263
- Files exist at /srv/dev-disk-by-uuid-.../music/...
264-
- Same files are also accessible at /data/music/...
264+
- Same files are also accessible via a symlink or different mount
265265
- Scanner should recognize them as the same files by hash
266266
"""
267267
with tempfile.TemporaryDirectory() as tmpdir:

0 commit comments

Comments
 (0)