#66 Ajout de la configuration env.build.time

This commit is contained in:
FyloZ 2021-06-08 23:25:29 -04:00
parent c279931f13
commit 0b8e48f172
2 changed files with 6 additions and 2 deletions

View File

@ -90,7 +90,8 @@ enum class ConfigurationType(
TOUCH_UP_KIT_EXPIRATION("touchupkit.expiration"),
EMERGENCY_MODE_ENABLED("env.emergency", computed = true, public = true),
VERSION("env.version", computed = true),
BUILD_VERSION("env.build.version", computed = true),
BUILD_TIME("env.build.time", computed = true),
JAVA_VERSION("env.java.version", computed = true),
OPERATING_SYSTEM("env.os", computed = true)
;

View File

@ -11,7 +11,9 @@ import org.springframework.boot.info.BuildProperties
import org.springframework.context.annotation.Lazy
import org.springframework.data.repository.findByIdOrNull
import org.springframework.stereotype.Service
import java.time.LocalDate
import java.time.Period
import java.time.ZoneId
import javax.annotation.PostConstruct
interface ConfigurationService {
@ -138,7 +140,8 @@ class ConfigurationServiceImpl(
private fun getComputedConfiguration(key: ConfigurationType) = configuration(
key, when (key) {
ConfigurationType.EMERGENCY_MODE_ENABLED -> emergencyMode
ConfigurationType.VERSION -> buildInfo.version
ConfigurationType.BUILD_VERSION -> buildInfo.version
ConfigurationType.BUILD_TIME -> LocalDate.ofInstant(buildInfo.time, ZoneId.systemDefault()).toString()
ConfigurationType.DATABASE_SUPPORTED_VERSION -> SUPPORTED_DATABASE_VERSION
ConfigurationType.JAVA_VERSION -> Runtime.version()
ConfigurationType.OPERATING_SYSTEM -> "${System.getProperty("os.name")} ${System.getProperty("os.version")} ${