Skip to content

Commit

Permalink
handle missing cert files
Browse files Browse the repository at this point in the history
  • Loading branch information
dankoster committed Oct 25, 2024
1 parent 8cb4497 commit 3b9ee9d
Showing 1 changed file with 9 additions and 2 deletions.
11 changes: 9 additions & 2 deletions server/server.ts
Original file line number Diff line number Diff line change
Expand Up @@ -53,8 +53,15 @@ app.addEventListener("listen", ({ hostname, port, secure }) => {
);
});

const cert = Deno.readTextFileSync(`./chatmux.crt`)
const key = Deno.readTextFileSync(`./chatmux.key`)
let cert
let key

try {
cert = Deno.readTextFileSync(`./chatmux.crt`)
key = Deno.readTextFileSync(`./chatmux.key`)
} catch (error) {
console.log(error.message)
}

if (cert && key) {
console.log('starting server with certificate')
Expand Down

0 comments on commit 3b9ee9d

Please sign in to comment.