mirror of https://github.com/micromata/borgbackup-butler.git

Kai Reinhard
17.56.2021 812f12a69468d5b20fef7afc6cd82c130481e9ad
borgbutler-server/src/main/kotlin/de/micromata/borgbutler/server/RunningMode.kt
@@ -2,7 +2,6 @@
import org.slf4j.LoggerFactory
import java.awt.Desktop
import java.io.File
import java.util.*
object RunningMode {
@@ -41,13 +40,12 @@
    val runningInIDE: Boolean
        get() {
            val currentDir = System.getProperty("user.dir")
            val coreDir = File(currentDir, "borgbutler-core")
            val development = coreDir.exists() && File(coreDir, "build.gradle").exists()
            if (development) {
                log.warn("*** Starting BorgButler server in IDE mode. This mode shouldn't be used in production environments. ***")
            if (webBundled()) {
                return true
            } else {
                log.warn("*** BorgButler seems to run inside an IDE. ***")
                return false
            }
            return development
        }
    /**
@@ -62,6 +60,19 @@
        )
    }
    fun webBundled(): Boolean {
        var available = false
        RunningMode::class.java.getResourceAsStream("/web/index.html")?.use {
        //RunningMode::class.java.getResourceAsStream("/logback-spring.xml")?.use {
            log.info("Web app found (is bundled).")
            available = true
        }
        if (!available) {
            log.info("Web app isn't bundled (running in IDE?)")
        }
        return available
    }
    enum class UserManagement {
        SINGLE
    }