From 223e39209c719d42062f55177b744d196c5a51ef Mon Sep 17 00:00:00 2001 From: Preston Maness Date: Mon, 12 Jun 2023 01:00:05 -0500 Subject: [PATCH] Make sure default scheme is set here too --- src/server/index.js | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/src/server/index.js b/src/server/index.js index c348a13..313a15b 100644 --- a/src/server/index.js +++ b/src/server/index.js @@ -32,6 +32,10 @@ import * as doipjs from 'doipjs' import { fetchWKD, fetchHKP, fetchSignature, fetchKeybase } from './keys.js' import libravatar from 'libravatar' +const scheme = process.env.PROXY_SCHEME ? process.env.PROXY_SCHEME +: process.env.SCHEME ? process.env.SCHEME +: 'https' + const generateWKDProfile = async (id) => { logger.debug('Generating a WKD profile', { component: 'wkd_profile_generator', action: 'start', profile_id: id }) @@ -46,7 +50,7 @@ const generateWKDProfile = async (id) => { keyData = processKeyData(keyData) const keyoxideData = {} - keyoxideData.url = `${process.env.SCHEME}://${process.env.DOMAIN}/wkd/${id}` + keyoxideData.url = `${scheme}://${process.env.DOMAIN}/wkd/${id}` logger.debug('Generating a WKD profile', { component: 'wkd_profile_generator', action: 'done', profile_id: id }) @@ -88,9 +92,9 @@ const generateHKPProfile = async (id, keyserverDomain) => { const keyoxideData = {} if (!keyserverDomain || keyserverDomain === 'keys.openpgp.org') { - keyoxideData.url = `${process.env.SCHEME}://${process.env.DOMAIN}/hkp/${id}` + keyoxideData.url = `${scheme}://${process.env.DOMAIN}/hkp/${id}` } else { - keyoxideData.url = `${process.env.SCHEME}://${process.env.DOMAIN}/hkp/${keyserverDomain}/${id}` + keyoxideData.url = `${scheme}://${process.env.DOMAIN}/hkp/${keyserverDomain}/${id}` } logger.debug('Generating a HKP profile', @@ -196,7 +200,7 @@ const generateKeybaseProfile = async (username, fingerprint) => { keyData = processKeyData(keyData) const keyoxideData = {} - keyoxideData.url = `${process.env.SCHEME}://${process.env.DOMAIN}/keybase/${username}/${fingerprint}` + keyoxideData.url = `${scheme}://${process.env.DOMAIN}/keybase/${username}/${fingerprint}` logger.debug('Generating a Keybase profile', { component: 'keybase_profile_generator', action: 'done', username, fingerprint })