Browse Source

Minor Fixes: Added {useNewUrlParser} fix deprecated warning, suppress some console.log output

pull/1/head
Erik Römmelt 5 years ago
parent
commit
63e1363dd2
1 changed files with 16 additions and 13 deletions
  1. 16
    13
      server.js

+ 16
- 13
server.js View File

@@ -93,7 +93,7 @@ const mongoose = require('mongoose');
mongoose.Promise = global.Promise;

// Connecting to the database
mongoose.connect(dbConfig.url)
mongoose.connect(dbConfig.url, {useNewUrlParser: true})
.then(() => {
console.log("Successfully connected to MongoDB.");
}).catch(err => {
@@ -230,20 +230,23 @@ http.createServer (app) .listen (http_port, function () {
var options;
try {
try {
// In case it's a real certificate: add CA chain cersts (TODO: use array if required)
var ca = fs.readFileSync ('keys/ca_cert.pem');
// In case it's a real certificate: add CA chain cersts (TODO: use array if required)
var ca = fs.readFileSync ('keys/ca_cert.pem');
} catch (e) {
ca = undefined;
console.log ("Note: Can't read CA bundle: "+e);
ca = undefined;
console.log ("Note: Can't read CA bundle: "+e);
}
options = {
key: fs.readFileSync ('keys/omkey.pem'),
cert: fs.readFileSync ('keys/certificate.pem'),
ca: ca
};
https.createServer (options, app) .listen (https_port, function () {
console.log ("Express https server listening on port " + https_port);
});
if (ca != null) {

options = {
key: fs.readFileSync ('keys/omkey.pem'),
cert: fs.readFileSync ('keys/certificate.pem'),
ca: ca
};
https.createServer (options, app) .listen (https_port, function () {
console.log ("Express https server listening on port " + https_port);
});
}
} catch (e) {
console.log ("Note: Can't read SSL keys/certs: "+e+"\nDisabling https server");
}

Loading…
Cancel
Save