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

WIP
Kai Reinhard
17.20.2021 11ec58f6958c6b7dc2efdaed2ea9c50a70a4c648
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
package de.micromata.borgbutler.server
 
import de.micromata.borgbutler.config.Configuration
import de.micromata.borgbutler.config.ConfigurationHandler.Companion.getConfiguration
import mu.KotlinLogging
import org.apache.commons.lang3.StringUtils
import org.slf4j.LoggerFactory
import org.springframework.beans.factory.annotation.Value
import org.springframework.stereotype.Component
 
private val log = KotlinLogging.logger {}
 
class ServerConfiguration : Configuration() {
    var port = WEBSERVER_PORT_DEFAULT
 
    /**
     * If true, CrossOriginFilter will be set.
     */
    var webDevelopmentMode = WEB_DEVELOPMENT_MODE_PREF_DEFAULT
 
    fun copyFrom(other: ServerConfiguration) {
        super.copyFrom(other)
        port = other.port
        webDevelopmentMode = other.webDevelopmentMode
    }
 
    companion object {
        val supportedLanguages = arrayOf("en", "de")
        const val WEBSERVER_PORT_DEFAULT = 9042
        private const val WEB_DEVELOPMENT_MODE_PREF_DEFAULT = false
 
        @JvmStatic
        fun get(): ServerConfiguration {
            return getConfiguration() as ServerConfiguration
        }
    }
}