Make sure default scheme is set here too

This commit is contained in:
Preston Maness 2023-06-12 01:00:05 -05:00
parent 21bae8df69
commit 223e39209c

View file

@ -32,6 +32,10 @@ import * as doipjs from 'doipjs'
import { fetchWKD, fetchHKP, fetchSignature, fetchKeybase } from './keys.js' import { fetchWKD, fetchHKP, fetchSignature, fetchKeybase } from './keys.js'
import libravatar from 'libravatar' 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) => { const generateWKDProfile = async (id) => {
logger.debug('Generating a WKD profile', logger.debug('Generating a WKD profile',
{ component: 'wkd_profile_generator', action: 'start', profile_id: id }) { component: 'wkd_profile_generator', action: 'start', profile_id: id })
@ -46,7 +50,7 @@ const generateWKDProfile = async (id) => {
keyData = processKeyData(keyData) keyData = processKeyData(keyData)
const keyoxideData = {} 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', logger.debug('Generating a WKD profile',
{ component: 'wkd_profile_generator', action: 'done', profile_id: id }) { component: 'wkd_profile_generator', action: 'done', profile_id: id })
@ -88,9 +92,9 @@ const generateHKPProfile = async (id, keyserverDomain) => {
const keyoxideData = {} const keyoxideData = {}
if (!keyserverDomain || keyserverDomain === 'keys.openpgp.org') { 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 { } 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', logger.debug('Generating a HKP profile',
@ -196,7 +200,7 @@ const generateKeybaseProfile = async (username, fingerprint) => {
keyData = processKeyData(keyData) keyData = processKeyData(keyData)
const keyoxideData = {} 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', logger.debug('Generating a Keybase profile',
{ component: 'keybase_profile_generator', action: 'done', username, fingerprint }) { component: 'keybase_profile_generator', action: 'done', username, fingerprint })