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

Commit

Permalink
Leave support for old properties
Browse files Browse the repository at this point in the history
  • Loading branch information
SerVB committed Jul 7, 2021
1 parent e3c79ba commit 642ef15
Showing 1 changed file with 4 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -863,7 +863,9 @@ class ProjectorServer private constructor(
}

const val ENABLE_PROPERTY_NAME = "org.jetbrains.projector.server.enable"
const val HOST_PROPERTY_NAME_OLD = "org.jetbrains.projector.server.host"
const val HOST_PROPERTY_NAME = "ORG_JETBRAINS_PROJECTOR_SERVER_HOST"
const val PORT_PROPERTY_NAME_OLD = "org.jetbrains.projector.server.port"
const val PORT_PROPERTY_NAME = "ORG_JETBRAINS_PROJECTOR_SERVER_PORT"
private const val DEFAULT_PORT = 8887
const val TOKEN_ENV_NAME = "ORG_JETBRAINS_PROJECTOR_SERVER_HANDSHAKE_TOKEN"
Expand All @@ -882,10 +884,10 @@ class ProjectorServer private constructor(
const val ENABLE_CONNECTION_CONFIRMATION = "ORG_JETBRAINS_PROJECTOR_SERVER_CONNECTION_CONFIRMATION"

private fun getEnvHost(): InetAddress {
val host = getProperty(HOST_PROPERTY_NAME)
val host = getProperty(HOST_PROPERTY_NAME) ?: getProperty(HOST_PROPERTY_NAME_OLD)
return if (host != null) InetAddress.getByName(host) else getWildcardHostAddress()
}

fun getEnvPort() = getProperty(PORT_PROPERTY_NAME)?.toIntOrNull() ?: DEFAULT_PORT
fun getEnvPort() = (getProperty(PORT_PROPERTY_NAME) ?: getProperty(PORT_PROPERTY_NAME_OLD))?.toIntOrNull() ?: DEFAULT_PORT
}
}

0 comments on commit 642ef15

Please sign in to comment.