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

Kai Reinhard
17.59.2021 c6e77f6fa462e292db5f693a33e7c483b5a6e19e
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
package de.micromata.borgbutler.server
 
import mu.KotlinLogging
import org.springframework.beans.factory.annotation.Autowired
import org.springframework.context.annotation.Configuration
import org.springframework.web.servlet.config.annotation.CorsRegistry
import org.springframework.web.servlet.config.annotation.EnableWebMvc
import org.springframework.web.servlet.config.annotation.WebMvcConfigurer
 
 
private val log = KotlinLogging.logger {}
 
@Configuration
@EnableWebMvc
open class WebConfig : WebMvcConfigurer {
    override fun addCorsMappings(registry: CorsRegistry) {
        if (ServerConfiguration.get().isWebDevelopmentMode) {
            log.warn("*********************************")
            log.warn("***********            **********")
            log.warn("*********** ATTENTION! **********")
            log.warn("***********            **********")
            log.warn("*********** Running in **********")
            log.warn("*********** dev mode!  **********")
            log.warn("***********            **********")
            log.warn("*********************************")
            log.warn("Don't deliver this app in dev mode due to security reasons (CrossOriginFilter is set)!")
            registry.addMapping("/**")
        }
    }
}