ssl: Fix resolving path to builtin ssl certs if not overwritten

This commit is contained in:
Jonatan Nilsson 2021-10-14 10:09:59 +00:00
parent 035fb0d7d0
commit d7c544243c

View file

@ -1,4 +1,6 @@
import fs from 'fs'
import path from 'path'
import { fileURLToPath } from 'url'
import Nconf from 'nconf-lite'
const nconf = new Nconf()
@ -27,6 +29,8 @@ if (fs.existsSync(filename)) {
nconf.file('main', nconf.get('config') || '../config.json');
}
const __dirname = path.dirname(fileURLToPath(import.meta.url))
// Default variables
nconf.defaults({
name: nconf.get('name') || 'spserver',
@ -40,8 +44,8 @@ nconf.defaults({
level: 'info',
},
},
sslkey: 'key.pem',
sslcert: 'cert.pem',
sslkey: path.resolve(path.join(__dirname, '../key.pem')),
sslcert: path.resolve(path.join(__dirname, '../cert.pem')),
development: {
port: 3001,
bunyan: {