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

@@ -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)
}