Skip to content

Commit

Permalink
Kotlinize environment property
Browse files Browse the repository at this point in the history
  • Loading branch information
Brutus5000 committed Aug 9, 2023
1 parent 20d4c73 commit b08708a
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ import java.util.*

@ConfigMapping(prefix = "faf")
interface FafProperties {
fun environment(): Optional<String>
fun environment(): String?

/**
* Define the header, where to pick the real ip address from. For regular reverse proxies such as nginx or Traefik,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -48,10 +48,10 @@ class BackgroundHeader(fafProperties: FafProperties) : Header() {
leftHeader.add(imageLink)

val environment = fafProperties.environment()
.map { it.ifBlank { null } }
.map { it?.uppercase() }
.map { "[$it] FAForever" }
.orElse("FAForever")
?.uppercase()
?.ifBlank { null }
?.let { "[$it] FAForever" }
?: "FAForever"

leftHeader.add(H1(environment))

Expand All @@ -65,4 +65,4 @@ class CardLayout : VerticalLayout(), RouterLayout {
init {
addClassName("main-card")
}
}
}

0 comments on commit b08708a

Please sign in to comment.