Avoid using internal server DNS-based heuristic by default (#3045)
This commit is contained in:
committed by
Nikolay Igotti
parent
a994f51402
commit
7c881e3bef
@@ -282,17 +282,19 @@ internal object InternalServer {
|
|||||||
|
|
||||||
private val internalDomain = "labs.intellij.net"
|
private val internalDomain = "labs.intellij.net"
|
||||||
|
|
||||||
val isAvailable by lazy {
|
val isAvailable: Boolean get() {
|
||||||
val envKey = "KONAN_USE_INTERNAL_SERVER"
|
val envKey = "KONAN_USE_INTERNAL_SERVER"
|
||||||
val envValue = System.getenv(envKey)
|
val envValue = System.getenv(envKey)
|
||||||
when (envValue) {
|
return when (envValue) {
|
||||||
"0" -> false
|
null, "0" -> false
|
||||||
"1" -> true
|
"1" -> true
|
||||||
null -> checkAccessible()
|
"auto" -> isAccessible
|
||||||
else -> error("unexpected environment: $envKey=$envValue")
|
else -> error("unexpected environment: $envKey=$envValue")
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private val isAccessible by lazy { checkAccessible() }
|
||||||
|
|
||||||
private fun checkAccessible() = try {
|
private fun checkAccessible() = try {
|
||||||
if (!InetAddress.getLocalHost().canonicalHostName.endsWith(".$internalDomain")) {
|
if (!InetAddress.getLocalHost().canonicalHostName.endsWith(".$internalDomain")) {
|
||||||
// Fast path:
|
// Fast path:
|
||||||
|
|||||||
Reference in New Issue
Block a user