This commit is contained in:
dintho 2025-12-27 19:00:23 +00:00 committed by GitHub
commit 734d9a0c4b
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -4,7 +4,15 @@
* Note that exiting with code 1 indicates failure, and 0 is success
*/
const isSsl = !!process.env.SSL_PRIV_KEY_PATH && !!process.env.SSL_PUB_KEY_PATH;
const fs = require('fs');
/* setting default paths for public and pvt keys to match of ssl-server.js */
const httpsCerts = {
private: process.env.SSL_PRIV_KEY_PATH || '/etc/ssl/certs/dashy-priv.key',
public: process.env.SSL_PUB_KEY_PATH || '/etc/ssl/certs/dashy-pub.pem',
};
/* Check if either if simular conditions exist that would of had ssl-server.js to enable ssl */
const isSsl = !!fs.existsSync(httpsCerts.private) && !!fs.existsSync(httpsCerts.public);
// eslint-disable-next-line import/no-dynamic-require
const http = require(isSsl ? 'https' : 'http');