mirror of
https://github.com/Suwayomi/Suwayomi-Server.git
synced 2026-07-02 10:24:35 -05:00
ability to override server.conf with java -D arguments
This commit is contained in:
@@ -8,30 +8,31 @@ package suwayomi.tachidesk.server
|
||||
* file, You can obtain one at https://mozilla.org/MPL/2.0/. */
|
||||
|
||||
import com.typesafe.config.Config
|
||||
import io.github.config4k.getValue
|
||||
import xyz.nulldev.ts.config.ConfigModule
|
||||
import xyz.nulldev.ts.config.GlobalConfigManager
|
||||
import xyz.nulldev.ts.config.debugLogsEnabled
|
||||
|
||||
class ServerConfig(config: Config) : ConfigModule(config) {
|
||||
val ip: String by config
|
||||
val port: Int by config
|
||||
|
||||
val webUIEnabled: Boolean = System.getProperty(
|
||||
"suwayomi.tachidesk.server.webUIEnabled", config.getString("webUIEnabled")
|
||||
).toBoolean()
|
||||
class ServerConfig(config: Config, moduleName: String = "") : ConfigModule(config, moduleName) {
|
||||
val ip: String by overridableWithSysProperty
|
||||
val port: Int by overridableWithSysProperty
|
||||
|
||||
// proxy
|
||||
val socksProxyEnabled: Boolean by config
|
||||
val socksProxyHost: String by config
|
||||
val socksProxyPort: String by config
|
||||
val socksProxyEnabled: Boolean by overridableWithSysProperty
|
||||
|
||||
val socksProxyHost: String by overridableWithSysProperty
|
||||
val socksProxyPort: String by overridableWithSysProperty
|
||||
|
||||
// misc
|
||||
val debugLogsEnabled: Boolean = debugLogsEnabled(GlobalConfigManager.config)
|
||||
val systemTrayEnabled: Boolean by config
|
||||
val initialOpenInBrowserEnabled: Boolean by config
|
||||
val systemTrayEnabled: Boolean by overridableWithSysProperty
|
||||
|
||||
// webUI
|
||||
val webUIEnabled: Boolean by overridableWithSysProperty
|
||||
val initialOpenInBrowserEnabled: Boolean by overridableWithSysProperty
|
||||
val webUIBrowser: String by overridableWithSysProperty
|
||||
val electronPath: String by overridableWithSysProperty
|
||||
|
||||
companion object {
|
||||
fun register(config: Config) = ServerConfig(config.getConfig("server"))
|
||||
fun register(config: Config) = ServerConfig(config.getConfig("server"), "server")
|
||||
}
|
||||
}
|
||||
|
||||
@@ -17,12 +17,9 @@ object Browser {
|
||||
private val electronInstances = mutableListOf<Any>()
|
||||
|
||||
fun openInBrowser() {
|
||||
|
||||
val openInElectron = System.getProperty("suwayomi.tachidesk.server.webInterface")?.equals("electron")
|
||||
|
||||
if (openInElectron == true) {
|
||||
if (serverConfig.webUIBrowser == ("electron")) {
|
||||
try {
|
||||
val electronPath = System.getProperty("suwayomi.tachidesk.server.electronPath")!!
|
||||
val electronPath = serverConfig.electronPath
|
||||
electronInstances.add(ProcessBuilder(electronPath, appBaseUrl).start())
|
||||
} catch (e: Throwable) { // cover both java.lang.Exception and java.lang.Error
|
||||
e.printStackTrace()
|
||||
|
||||
@@ -14,3 +14,5 @@ server.systemTrayEnabled = true
|
||||
# webUI
|
||||
server.webUIEnabled = true
|
||||
server.initialOpenInBrowserEnabled = true
|
||||
server.webUIBrowser = "browser" # "browser" or "electron"
|
||||
server.electronPath = ""
|
||||
|
||||
Reference in New Issue
Block a user