Skip to content

Commit

Permalink
HAI Log features at startup (#401)
Browse files Browse the repository at this point in the history
  • Loading branch information
corvidian authored Sep 5, 2023
1 parent 86012b9 commit ca37573
Showing 1 changed file with 11 additions and 0 deletions.
Original file line number Diff line number Diff line change
@@ -1,11 +1,22 @@
package fi.hel.haitaton.hanke.configuration

import fi.hel.haitaton.hanke.EndpointDisabledException
import mu.KotlinLogging
import org.springframework.boot.context.event.ApplicationReadyEvent
import org.springframework.boot.context.properties.ConfigurationProperties
import org.springframework.context.event.EventListener

private val logger = KotlinLogging.logger {}

@ConfigurationProperties(prefix = "haitaton")
data class FeatureFlags(val features: Map<Feature, Boolean>) {

@EventListener(ApplicationReadyEvent::class)
fun logWarning() {
logger.info { "Listing feature flags:" }
features.forEach { logger.info { "Feature ${it.key} is ${it.value}" } }
}

/** Disabled by default, if not in application.properties. */
private fun isEnabled(feature: Feature): Boolean = features.getOrDefault(feature, false)

Expand Down

0 comments on commit ca37573

Please sign in to comment.