Skip to content

Commit

Permalink
Add missing local changes
Browse files Browse the repository at this point in the history
  • Loading branch information
peel committed Jun 3, 2024
1 parent b0594ff commit 6f22ddf
Showing 1 changed file with 4 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -217,16 +217,16 @@ object HttpServer {
)
}

def mkTls(secure: Boolean): Resource[F, KeyManagerFactory] =
def mkTls(secure: Boolean): Resource[F, Option[KeyManagerFactory]] =
if (secure) {
for {
tlsConfig <- Resource.eval(ArmeriaTlsConfig.from(System.getProperties()))
kmf = KeyManagerFactory.getInstance(KeyManagerFactory.getDefaultAlgorithm)
ks = KeyStore.getInstance(tlsConfig.ksType)
_ <- Resource.eval(Async[F].delay(ks.load(new FileInputStream(tlsConfig.ksPath), tlsConfig.ksPass.toArray)))
_ <- Resource.eval(Async[F].delay(kmf.init(ks, tlsConfig.ksPass.toArray)))
} yield kmf
} else Resource.never
} yield Some(kmf)
} else Resource.pure(None)

for {
_ <- Resource.eval(Logger[F].info(s"Building Armeria server"))
Expand All @@ -238,7 +238,7 @@ object HttpServer {
"/",
loggerMiddleware(timeoutMiddleware(hstsMiddleware(hsts, routes.orNotFound), networking), debugHttp)
)
.cond(secure, _.withTls(kmf))
.cond(secure && kmf.isDefined, _.withTls(kmf.get))
.withIdleTimeout(networking.idleTimeout)
.withRequestTimeout(networking.responseHeaderTimeout)
.resource
Expand Down

0 comments on commit 6f22ddf

Please sign in to comment.