From 5435906c3ae5200e1b2fd2246b94b1d51eaca57e Mon Sep 17 00:00:00 2001 From: Katze719 Date: Thu, 5 Sep 2024 19:47:26 +0000 Subject: [PATCH] fix: :bug: use cert as text file --- fresh.config.ts | 18 ++++-------------- 1 file changed, 4 insertions(+), 14 deletions(-) diff --git a/fresh.config.ts b/fresh.config.ts index 03b8e06..c52a6a0 100644 --- a/fresh.config.ts +++ b/fresh.config.ts @@ -5,21 +5,11 @@ const port = Number(Deno.env.get("DENO_PORT")) || 8000; const certFile = Deno.env.get("DENO_CERTFILE"); const keyFile = Deno.env.get("DENO_KEYFILE"); -if (certFile && keyFile) { - try { - await Deno.stat(certFile); - await Deno.stat(keyFile); - } catch (error) { - console.error("Error accessing certificate or key file:", error); - Deno.exit(1); - } -} else { - console.error("Cert file or key file not specified."); - Deno.exit(1); -} +const cert = certFile ? await Deno.readTextFile(certFile) : undefined; +const key = keyFile ? await Deno.readTextFile(keyFile) : undefined; export default defineConfig({ port: port, - cert: certFile, - key: keyFile, + cert: cert, + key: key, });