Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -371,15 +371,21 @@
// make assumption that all requests will resolve to the same CA
// also terrible assumption that default endpoint is reachable
val qUri = URI(QDefaultServiceConfig.ENDPOINT)
val rtsTrustChain = TrustChainUtil.getTrustChain(qUri)
val extraCaCerts = Files.createTempFile("q-extra-ca", ".pem").apply {
writeText(
TrustChainUtil.certsToPem(rtsTrustChain)
)
val extraCaCerts = try {
val rtsTrustChain = TrustChainUtil.getTrustChain(qUri)

Check warning on line 375 in plugins/amazonq/shared/jetbrains-community/src/software/aws/toolkits/jetbrains/services/amazonq/lsp/AmazonQLspService.kt

View check run for this annotation

Codecov / codecov/patch

plugins/amazonq/shared/jetbrains-community/src/software/aws/toolkits/jetbrains/services/amazonq/lsp/AmazonQLspService.kt#L374-L375

Added lines #L374 - L375 were not covered by tests

Files.createTempFile("q-extra-ca", ".pem").apply {
writeText(
TrustChainUtil.certsToPem(rtsTrustChain)

Check warning on line 379 in plugins/amazonq/shared/jetbrains-community/src/software/aws/toolkits/jetbrains/services/amazonq/lsp/AmazonQLspService.kt

View check run for this annotation

Codecov / codecov/patch

plugins/amazonq/shared/jetbrains-community/src/software/aws/toolkits/jetbrains/services/amazonq/lsp/AmazonQLspService.kt#L377-L379

Added lines #L377 - L379 were not covered by tests
)
}
} catch (e: Exception) {
LOG.info(e) { "Could not resolve trust chain for $qUri, skipping NODE_EXTRA_CA_CERTS" }
null

Check warning on line 384 in plugins/amazonq/shared/jetbrains-community/src/software/aws/toolkits/jetbrains/services/amazonq/lsp/AmazonQLspService.kt

View check run for this annotation

Codecov / codecov/patch

plugins/amazonq/shared/jetbrains-community/src/software/aws/toolkits/jetbrains/services/amazonq/lsp/AmazonQLspService.kt#L381-L384

Added lines #L381 - L384 were not covered by tests
}

val node = if (SystemInfo.isWindows) "node.exe" else "node"
var nodePath = getNodeRuntimePath(artifact.resolve(node))
val nodePath = getNodeRuntimePath(artifact.resolve(node))

Check warning on line 388 in plugins/amazonq/shared/jetbrains-community/src/software/aws/toolkits/jetbrains/services/amazonq/lsp/AmazonQLspService.kt

View check run for this annotation

Codecov / codecov/patch

plugins/amazonq/shared/jetbrains-community/src/software/aws/toolkits/jetbrains/services/amazonq/lsp/AmazonQLspService.kt#L388

Added line #L388 was not covered by tests

val cmd = NodeExePatcher.patch(nodePath)
.withParameters(
Expand All @@ -388,7 +394,7 @@
"--set-credentials-encryption-key",
).withEnvironment(
buildMap {
put("NODE_EXTRA_CA_CERTS", extraCaCerts.toAbsolutePath().toString())
extraCaCerts?.let { put("NODE_EXTRA_CA_CERTS", it.toAbsolutePath().toString()) }

val proxy = JdkProxyProvider.getInstance().proxySelector.select(qUri)
// log if only socks proxy available
Expand Down
Loading