Merge pull request #1028 from thelounge/xpaw/cert-var
Use local variables to check length
This commit is contained in:
commit
3e9678d9cf
@ -42,17 +42,20 @@ module.exports = function() {
|
|||||||
server = require("http");
|
server = require("http");
|
||||||
server = server.createServer(app);
|
server = server.createServer(app);
|
||||||
} else {
|
} else {
|
||||||
server = require("spdy");
|
|
||||||
const keyPath = Helper.expandHome(config.https.key);
|
const keyPath = Helper.expandHome(config.https.key);
|
||||||
const certPath = Helper.expandHome(config.https.certificate);
|
const certPath = Helper.expandHome(config.https.certificate);
|
||||||
if (!config.https.key.length || !fs.existsSync(keyPath)) {
|
|
||||||
|
if (!keyPath.length || !fs.existsSync(keyPath)) {
|
||||||
log.error("Path to SSL key is invalid. Stopping server...");
|
log.error("Path to SSL key is invalid. Stopping server...");
|
||||||
process.exit();
|
process.exit();
|
||||||
}
|
}
|
||||||
if (!config.https.certificate.length || !fs.existsSync(certPath)) {
|
|
||||||
|
if (!certPath.length || !fs.existsSync(certPath)) {
|
||||||
log.error("Path to SSL certificate is invalid. Stopping server...");
|
log.error("Path to SSL certificate is invalid. Stopping server...");
|
||||||
process.exit();
|
process.exit();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
server = require("spdy");
|
||||||
server = server.createServer({
|
server = server.createServer({
|
||||||
key: fs.readFileSync(keyPath),
|
key: fs.readFileSync(keyPath),
|
||||||
cert: fs.readFileSync(certPath)
|
cert: fs.readFileSync(certPath)
|
||||||
|
Loading…
Reference in New Issue
Block a user