mirror of
https://github.com/key-networks/ztncui.git
synced 2025-06-06 02:03:45 +02:00
Don't try to read TLS cert files when not using HTTPS
This commit is contained in:
parent
0b36f83b34
commit
2d6d255b24
1 changed files with 5 additions and 5 deletions
10
src/bin/www
10
src/bin/www
|
@ -10,11 +10,6 @@ const http = require('http');
|
|||
const https = require('https');
|
||||
const fs = require('fs');
|
||||
|
||||
const options = {
|
||||
// cert: fs.readFileSync('etc/tls/fullchain.pem'),
|
||||
// key: fs.readFileSync('etc/tls/privkey.pem')
|
||||
}
|
||||
|
||||
/**
|
||||
* Get ports from environment and store in Express.
|
||||
*/
|
||||
|
@ -50,6 +45,11 @@ if (http_all_interfaces) {
|
|||
app.listen(http_port, 'localhost');
|
||||
}
|
||||
|
||||
const options = !https_port ? {} : {
|
||||
cert: fs.readFileSync('etc/tls/fullchain.pem'),
|
||||
key: fs.readFileSync('etc/tls/privkey.pem')
|
||||
};
|
||||
|
||||
const server = https.createServer(options, app);
|
||||
|
||||
if (https_port) {
|
||||
|
|
Loading…
Add table
Reference in a new issue