solution: banner on run
This commit is contained in:
@@ -20,8 +20,10 @@ import org.springframework.beans.factory.config.YamlPropertiesFactoryBean
|
||||
import org.springframework.core.env.*
|
||||
import org.springframework.core.io.FileSystemResource
|
||||
import org.springframework.core.io.Resource
|
||||
import org.springframework.core.io.support.ResourcePropertySource
|
||||
import java.io.File
|
||||
import java.util.*
|
||||
import javax.annotation.PostConstruct
|
||||
|
||||
const val DEFAULT_CONFIG = "/etc/dshackle/dshackle.yaml"
|
||||
const val LOCAL_CONFIG = "./dshackle.yaml"
|
||||
@@ -32,10 +34,10 @@ open class DshackleEnvironment: StandardEnvironment() {
|
||||
private val log = LoggerFactory.getLogger(DshackleEnvironment::class.java)
|
||||
}
|
||||
|
||||
|
||||
override fun customizePropertySources(propertySources: MutablePropertySources) {
|
||||
super.customizePropertySources(propertySources)
|
||||
propertySources.addLast(mainConfig())
|
||||
propertySources.addLast(ResourcePropertySource("version.properties"))
|
||||
}
|
||||
|
||||
open fun mainConfig(): PropertySource<*> {
|
||||
@@ -48,7 +50,6 @@ open class DshackleEnvironment: StandardEnvironment() {
|
||||
}
|
||||
}
|
||||
target = target.normalize()
|
||||
log.info("Load configuration from: ${target.absolutePath}")
|
||||
val loadedProperties = this.loadYaml(FileSystemResource(target))
|
||||
loadedProperties["configPath"] = target.absolutePath
|
||||
return PropertiesPropertySource("mainConfig", loadedProperties)
|
||||
|
||||
@@ -16,9 +16,11 @@
|
||||
package io.emeraldpay.dshackle
|
||||
|
||||
import org.slf4j.LoggerFactory
|
||||
import org.springframework.boot.ResourceBanner
|
||||
import org.springframework.boot.SpringApplication
|
||||
import org.springframework.boot.autoconfigure.SpringBootApplication
|
||||
import org.springframework.context.annotation.Import
|
||||
import org.springframework.core.io.ClassPathResource
|
||||
|
||||
@SpringBootApplication(scanBasePackages = [ "io.emeraldpay.dshackle" ])
|
||||
@Import(Config::class)
|
||||
@@ -29,5 +31,6 @@ private val log = LoggerFactory.getLogger(Starter::class.java)
|
||||
fun main(args: Array<String>) {
|
||||
val app = SpringApplication(Starter::class.java)
|
||||
app.setEnvironment(DshackleEnvironment())
|
||||
app.setBanner(ResourceBanner(ClassPathResource("banner.txt")))
|
||||
app.run(*args)
|
||||
}
|
||||
Reference in New Issue
Block a user