From e44a87e379c51995028b339dd8583cc6432822d0 Mon Sep 17 00:00:00 2001 From: Derrick Hammer Date: Fri, 22 Jul 2022 21:09:06 -0400 Subject: [PATCH] *Add method to check if we are in staging mode for ssl --- src/relay.ts | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/src/relay.ts b/src/relay.ts index f5cd996..4060c56 100644 --- a/src/relay.ts +++ b/src/relay.ts @@ -30,10 +30,9 @@ const sslParams: tls.SecureContextOptions = { cert: "", key: "" }; const sslPrivateKey = await acme.forge.createPrivateKey(); const acmeClient = new acme.Client({ accountKey: sslPrivateKey, - directoryUrl: - config.str("ssl-mode") === "staging" - ? acme.directory.letsencrypt.staging - : acme.directory.letsencrypt.production, + directoryUrl: isSSlStaging() + ? acme.directory.letsencrypt.staging + : acme.directory.letsencrypt.production, }); let app: Express; @@ -227,3 +226,7 @@ function getSeed(): Uint8Array { return seed; } + +function isSSlStaging() { + return config.str("ssl-mode") === "staging"; +}