Skip to content

Commit

Permalink
refactor: show manifest info when starting app
Browse files Browse the repository at this point in the history
  • Loading branch information
marcospereira authored and mergify[bot] committed May 4, 2024
1 parent 1511571 commit 9e7e46e
Showing 1 changed file with 10 additions and 0 deletions.
10 changes: 10 additions & 0 deletions src/main/kotlin/br/ufpe/liber/Application.kt
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@ package br.ufpe.liber

import io.micronaut.context.env.Environment
import io.micronaut.kotlin.runtime.startApplication
import org.slf4j.LoggerFactory
import java.util.Properties

// DO NOT EDIT: this file is automatically synced from the template repository
// in https://github.com/Liber-UFPE/project-starter.
Expand All @@ -11,9 +13,17 @@ object Application {
@Suppress("detekt:SpreadOperator")
fun main(args: Array<String>) {
startApplication<Application>(*args) {
val logger = LoggerFactory.getLogger(Application.javaClass)
// Fallback to dev environment if none is specified.
environments(System.getenv().getOrDefault("MICRONAUT_ENVIRONMENTS", Environment.DEVELOPMENT))
eagerInitAnnotated(EagerInProduction::class.java)
resourceLoader.getResource("META-INF/MANIFEST.MF").ifPresent { url ->
val properties = Properties()
url.openStream().use { inputStream -> properties.load(inputStream) }
for ((name, value) in properties) {
logger.info("Manifest property $name: $value")
}
}
}
}
}

0 comments on commit 9e7e46e

Please sign in to comment.