Skip to content

Commit

Permalink
refactor(shulker-proxy-agent,shulker-server-agent): make network admi…
Browse files Browse the repository at this point in the history
…ns optional
  • Loading branch information
jeremylvln committed Nov 2, 2023
1 parent d4fccbf commit 1bdac2f
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,9 @@ object Configuration {
val PROXY_NAME = getStringEnv("SHULKER_PROXY_NAME")
val PROXY_TTL_SECONDS = getLongEnv("SHULKER_PROXY_TTL_SECONDS")

val NETWORK_ADMINS = getStringEnv("SHULKER_NETWORK_ADMINS").split(",").map(UUID::fromString)
val NETWORK_ADMINS = (getOptionalStringEnv("SHULKER_NETWORK_ADMINS") ?: "")
.split(",")
.map(UUID::fromString)

val REDIS_HOST = getStringEnv("SHULKER_PROXY_REDIS_HOST")
val REDIS_PORT = getIntEnv("SHULKER_PROXY_REDIS_PORT")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,9 @@ package io.shulkermc.serveragent
import java.util.UUID

object Configuration {
val NETWORK_ADMINS = getStringEnv("SHULKER_NETWORK_ADMINS").split(",").map(UUID::fromString)
val NETWORK_ADMINS = (getOptionalStringEnv("SHULKER_NETWORK_ADMINS") ?: "")
.split(",")
.map(UUID::fromString)

private fun getStringEnv(name: String): String = requireNotNull(System.getenv(name)) { "Missing $name" }
private fun getOptionalStringEnv(name: String): String? = System.getenv(name)
}

0 comments on commit 1bdac2f

Please sign in to comment.