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

Kai Reinhard
19.04.2021 341d1baaf08d82b5af1509441050c0eef234ea5f
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
package de.micromata.borgbutler.server
 
import de.micromata.borgbutler.config.Configuration
import de.micromata.borgbutler.config.ConfigurationHandler.Companion.getConfiguration
import mu.KotlinLogging
 
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
        }
    }
}