Skip to content
This repository was archived by the owner on Mar 26, 2024. It is now read-only.

Commit

Permalink
SSL_ENV_NAME read from system property
Browse files Browse the repository at this point in the history
  • Loading branch information
IKrukov-HORIS committed Sep 7, 2020
1 parent 46977d5 commit 100ba42
Showing 1 changed file with 7 additions and 7 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -423,13 +423,9 @@ class ProjectorServer private constructor(

val toServerHandshakeEvent = KotlinxJsonToServerHandshakeDecoder.decode(message)

fun getToken(tokenName: String): String? {
return System.getProperty(tokenName) ?: System.getenv(tokenName)
}

val hasWriteAccess = when (toServerHandshakeEvent.token) {
getToken(TOKEN_ENV_NAME) -> true
getToken(RO_TOKEN_ENV_NAME) -> false
getProperty(TOKEN_ENV_NAME) -> true
getProperty(RO_TOKEN_ENV_NAME) -> false
else -> {
sendHandshakeFailureEvent("Bad handshake token")
return
Expand Down Expand Up @@ -765,6 +761,10 @@ class ProjectorServer private constructor(
val isEnabled: Boolean
get() = System.getProperty(ENABLE_PROPERTY_NAME)?.toBoolean() ?: false

private fun getProperty(propName: String): String? {
return System.getProperty(propName) ?: System.getenv(propName)
}

private val mouseModifierMask = mapOf(
MouseModifier.ALT_KEY to InputEvent.ALT_DOWN_MASK,
MouseModifier.CTRL_KEY to InputEvent.CTRL_DOWN_MASK,
Expand Down Expand Up @@ -913,7 +913,7 @@ class ProjectorServer private constructor(
}

private fun setSsl(setWebSocketFactory: (WebSocketServerFactory) -> Unit): String? {
val sslPropertiesFilePath = System.getenv(SSL_ENV_NAME) ?: return null
val sslPropertiesFilePath = getProperty(SSL_ENV_NAME) ?: return null

try {
val properties = Properties().apply {
Expand Down

0 comments on commit 100ba42

Please sign in to comment.