Skip to content

Commit

Permalink
perf: load tls files in parallel
Browse files Browse the repository at this point in the history
  • Loading branch information
dnalborczyk committed Aug 4, 2022
1 parent 812f122 commit 333ccd0
Showing 1 changed file with 10 additions and 3 deletions.
13 changes: 10 additions & 3 deletions src/events/http/HttpServer.js
Original file line number Diff line number Diff line change
Expand Up @@ -81,9 +81,14 @@ export default class HttpServer {

// https support
if (typeof httpsProtocol === 'string' && httpsProtocol.length > 0) {
const [cert, key] = await Promise([
readFile(resolve(httpsProtocol, 'cert.pem'), 'ascii'),
readFile(resolve(httpsProtocol, 'key.pem'), 'ascii'),
])

serverOptions.tls = {
cert: await readFile(resolve(httpsProtocol, 'cert.pem'), 'ascii'),
key: await readFile(resolve(httpsProtocol, 'key.pem'), 'ascii'),
cert,
key,
}
}

Expand All @@ -103,7 +108,9 @@ export default class HttpServer {
? request.response.output
: request.response

const explicitlySetHeaders = { ...response.headers }
const explicitlySetHeaders = {
...response.headers,
}

if (
this.#serverless.service.provider.httpApi &&
Expand Down

0 comments on commit 333ccd0

Please sign in to comment.