From 5a913fdfbbfb96223625b4372b49e4e407311adf Mon Sep 17 00:00:00 2001 From: schroda <50052685+schroda@users.noreply.github.com> Date: Sun, 30 Jul 2023 16:29:09 +0200 Subject: [PATCH] Make path to local source changeable (#626) --- .../src/main/kotlin/suwayomi/tachidesk/server/ServerConfig.kt | 3 +++ .../src/main/kotlin/suwayomi/tachidesk/server/ServerSetup.kt | 2 +- server/src/main/resources/server-reference.conf | 3 +++ server/src/test/resources/server-reference.conf | 3 +++ 4 files changed, 10 insertions(+), 1 deletion(-) diff --git a/server/src/main/kotlin/suwayomi/tachidesk/server/ServerConfig.kt b/server/src/main/kotlin/suwayomi/tachidesk/server/ServerConfig.kt index 737b0a4aa..c3f0ce018 100644 --- a/server/src/main/kotlin/suwayomi/tachidesk/server/ServerConfig.kt +++ b/server/src/main/kotlin/suwayomi/tachidesk/server/ServerConfig.kt @@ -58,6 +58,9 @@ class ServerConfig(getConfig: () -> Config, moduleName: String = MODULE_NAME) : var backupInterval: Int by overridableConfig var backupTTL: Int by overridableConfig + // local source + var localSourcePath: String by overridableConfig + companion object { fun register(getConfig: () -> Config) = ServerConfig({ getConfig().getConfig(MODULE_NAME) }) } diff --git a/server/src/main/kotlin/suwayomi/tachidesk/server/ServerSetup.kt b/server/src/main/kotlin/suwayomi/tachidesk/server/ServerSetup.kt index b8c721363..2c97ae67e 100644 --- a/server/src/main/kotlin/suwayomi/tachidesk/server/ServerSetup.kt +++ b/server/src/main/kotlin/suwayomi/tachidesk/server/ServerSetup.kt @@ -47,7 +47,7 @@ class ApplicationDirs( val extensionsRoot = "$dataRoot/extensions" val thumbnailsRoot = "$dataRoot/thumbnails" val mangaDownloadsRoot = serverConfig.downloadsPath.ifBlank { "$dataRoot/downloads" } - val localMangaRoot = "$dataRoot/local" + val localMangaRoot = serverConfig.localSourcePath.ifBlank { "$dataRoot/local" } val webUIRoot = "$dataRoot/webUI" val automatedBackupRoot = serverConfig.backupPath.ifBlank { "$dataRoot/backups" } diff --git a/server/src/main/resources/server-reference.conf b/server/src/main/resources/server-reference.conf index b790bac7e..18df87718 100644 --- a/server/src/main/resources/server-reference.conf +++ b/server/src/main/resources/server-reference.conf @@ -42,3 +42,6 @@ server.backupPath = "" server.backupTime = "00:00" # range: hour: 0-23, minute: 0-59 - default: "00:00" - time of day at which the automated backup should be triggered server.backupInterval = 1 # time in days - 0 to disable it - range: 1 <= n < ∞ - default: 1 day - interval in which the server will automatically create a backup server.backupTTL = 14 # time in days - 0 to disable it - range: 1 <= n < ∞ - default: 14 days - how long backup files will be kept before they will get deleted + +# local source +server.localSourcePath = "" diff --git a/server/src/test/resources/server-reference.conf b/server/src/test/resources/server-reference.conf index 0e8040e89..01057e9a8 100644 --- a/server/src/test/resources/server-reference.conf +++ b/server/src/test/resources/server-reference.conf @@ -35,3 +35,6 @@ server.backupPath = "" server.backupTime = "00:00" server.backupInterval = 1 server.backupTTL = 14 + +# local source +server.localSourcePath = ""