fix: make local development work out of the box

- library.example.yaml now uses relative ./media paths for local runs
- clearer startup errors for missing roots and config files
- ignore the local config/library.yaml override
This commit is contained in:
TapTap committed 2026-11-13 12:12:17 +00:00
1 parent f5e247e164
commit af2a8bd35d
5 files changed
+31 -11

No files matched your search

+1
View File
@@ -11,6 +11,7 @@ build/
# Local runtime data
data/
media/
config/library.yaml
config/users.yaml
*.db
*.db-shm
+6 -4
View File
@@ -25,18 +25,20 @@ mkdir -p media/music media/longform
library:
folders:
- id: 1
name: "Alice - Music"
name: "Music"
type: music
path: /absolute/path/to/music/alice
path: ./media/music
- id: 10
name: "Audiobooks & Podcasts"
type: longform
path: /absolute/path/to/longform
path: ./media/longform
```
The example file already uses these relative paths, so no edit is needed for local development. Relative paths are resolved from the working directory (`./gradlew run` uses the project root). For deployment, replace them with absolute paths such as `/mnt/media/music/alice` (see Section 6.1).
- `type: music` roots are assigned per user; `type: longform` roots are shared with every user.
- `id` must be stable and unique (integers). It is part of song IDs, so do not renumber it after a scan.
- Paths must exist and be readable, otherwise the server refuses to start.
- Paths must exist and be readable, otherwise the server refuses to start with a clear error naming the folder.
### 3. Configure users
+10 -3
View File
@@ -1,4 +1,11 @@
# Example library configuration. Mount the real file as a ConfigMap.
# Example library configuration.
#
# The paths below are relative to the working directory and are meant for local
# development: `./gradlew run` creates a `./media` tree after you run
# `mkdir -p media/music media/longform`.
#
# In Kubernetes the real file is mounted as a ConfigMap and should use absolute
# paths, e.g. /mnt/media/music/alice and /mnt/media/longform.
#
# Folder IDs are stable identifiers used by songs and users. Never reuse an ID
# for a different path.
@@ -7,8 +14,8 @@ library:
- id: 1
name: "Music"
type: music
path: /mnt/media/music
path: ./media/music
- id: 10
name: "Audiobooks & Podcasts"
type: longform
path: /mnt/media/longform
path: ./media/longform
@@ -35,17 +35,24 @@ data class LibraryConfig(val folders: List<MusicFolder>) {
fun validatePaths() {
folders.forEach { folder ->
require(Files.isDirectory(folder.path)) {
"Library folder ${folder.id} (${folder.name}) is not a directory: ${folder.path}"
"Library folder ${folder.id} (${folder.name}) is not a directory: ${folder.path}. " +
"Create the directory or fix the path in the library config (LIBRARY_CONFIG). " +
"For local development, copy config/library.example.yaml and run " +
"`mkdir -p media/music media/longform`."
}
require(Files.isReadable(folder.path)) {
"Library folder ${folder.id} (${folder.name}) is not readable: ${folder.path}"
"Library folder ${folder.id} (${folder.name}) is not readable: ${folder.path}. " +
"Check the directory permissions."
}
}
}
companion object {
fun load(path: Path): LibraryConfig {
require(Files.isRegularFile(path)) { "Library config not found: $path" }
require(Files.isRegularFile(path)) {
"Library config not found: $path. Copy config/library.example.yaml to " +
"config/library.yaml or point LIBRARY_CONFIG at an existing file."
}
val text = Files.readString(path)
return parse(text)
}
@@ -53,7 +53,10 @@ data class UsersConfig(val users: List<UserAccount>) {
private val NAME_PATTERN = Regex("[A-Za-z0-9._-]{1,64}")
fun load(path: Path): UsersConfig {
require(Files.isRegularFile(path)) { "Users file not found: $path" }
require(Files.isRegularFile(path)) {
"Users file not found: $path. Copy config/users.example.yaml to config/users.yaml " +
"or point USERS_FILE at the Vault-managed file."
}
val text = Files.readString(path)
return parse(text)
}