Rework the https refresh logic

- puts the node version check first
 - validates the refresh interval and keeps it in valid range
 - simplifies the error messages
 - uses parseFloat not parseInt so we can use fractions of hour
This commit is contained in:
Nick O'Leary
2020-05-29 16:50:53 +01:00
parent 40101df6ec
commit bb41ab482c
3 changed files with 46 additions and 43 deletions

View File

@@ -140,19 +140,21 @@ module.exports = {
// See http://nodejs.org/api/https.html#https_https_createserver_options_requestlistener
// for details on its contents.
// See the comment at the top of this file on how to load the `fs` module used by this setting.
// This property can be an object, containing both a (private) key and a (public) certificate:
// This property can be either an object, containing both a (private) key and a (public) certificate,
// or a function that returns such an object:
//// https object:
//https: {
// key: fs.readFileSync('privkey.pem'),
// cert: fs.readFileSync('cert.pem')
//},
// This property can also be a function (e.g. to automatic refresh the https settings synchronously):
////https synchronous function:
//https: function() {
// return {
// key: fs.readFileSync('privkey.pem'),
// cert: fs.readFileSync('cert.pem')
// }
//},
// This property can also be a promise (e.g. to automatic refresh the https settings asynchronously):
//// https asynchronous function:
//https: function() {
// return Promise.resolve({
// key: fs.readFileSync('privkey.pem'),
@@ -160,9 +162,12 @@ module.exports = {
// });
//},
// The following property can be used to refresh the https settings at regular time intervals (hours).
// Prerequisite: the 'https' property should be enabled (based on a function)!
// Caution: NodeJs version 11 or above is required to use this option!
// The following property can be used to refresh the https settings at a
// regular time interval in hours.
// This requires:
// - the `https` setting to be a function that can be called to get
// the refreshed settings.
// - Node.js 11 or later.
//httpsRefreshInterval : 12,
// The following property can be used to cause insecure HTTP connections to