Skip to content

Commit

Permalink
Write exception reports into the logfile in case of ssl misconfigurat…
Browse files Browse the repository at this point in the history
…ion (#11776)

CHANGELOG_BEGIN
CHANGELOG_END
  • Loading branch information
mziolekda committed Nov 19, 2021
1 parent 8fe9e04 commit 1760e0c
Showing 1 changed file with 7 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@
package com.daml.platform.apiserver

import java.util.concurrent.Executor

import com.daml.ledger.api.tls.TlsConfiguration
import com.daml.ledger.resources.{Resource, ResourceContext, ResourceOwner}
import com.daml.logging.{ContextualizedLogger, LoggingContext}
Expand All @@ -13,6 +12,7 @@ import com.daml.ports.Port
import io.grpc.ServerInterceptor

import scala.concurrent.{Future, Promise}
import scala.util.{Failure, Success}

private[daml] final class LedgerApiServer(
apiServicesOwner: ResourceOwner[ApiServices],
Expand All @@ -32,7 +32,7 @@ private[daml] final class LedgerApiServer(
val servicesClosedPromise = Promise[Unit]()

val apiServicesResource = apiServicesOwner.acquire()
for {
(for {
apiServices <- apiServicesResource
sslContext = tlsConfiguration.flatMap(_.server)
_ = tlsConfiguration.map(_.setJvmTlsProperties())
Expand Down Expand Up @@ -65,6 +65,11 @@ private[daml] final class LedgerApiServer(
override def servicesClosed(): Future[Unit] =
servicesClosedPromise.future
}
}).transformWith {
case Failure(ex) =>
logger.error("Failed to create LedgerApiServer", ex)
Resource.failed(ex)
case Success(s) => Resource.successful(s)
}
}
}

0 comments on commit 1760e0c

Please sign in to comment.