mirror of
https://github.com/Lissy93/dashy.git
synced 2025-12-06 16:43:13 +01:00
Adjusting SSL Portion of HealthCheck
I ran into a issue running dashy in a podman oci container with the default value for public & private key paths not being set the same way in healthcheck.js vs ssl-server.js This difference was allowing SSL to start causing the healthcheck to get a 302 redirect to https . This change adds in the same default path vars and i am going to say similar behavior that ssl-server.js uses. i tried to match the same style as the existing code between the two files another alternative is to set `SSL_PUB_KEY_PATH` and `SSL_PRIV_KEY_PATH` in the compose file as env vars but after seeing #843 which lead me #768 and then finding #1410 ill be honest this probably solves #843 and #1410 i dont think this totally solved #768 tbh. i had a hard time following that thread
This commit is contained in:
parent
befa9a5c25
commit
a130d6c9e6
1 changed files with 9 additions and 1 deletions
|
|
@ -4,7 +4,15 @@
|
||||||
* Note that exiting with code 1 indicates failure, and 0 is success
|
* 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
|
// eslint-disable-next-line import/no-dynamic-require
|
||||||
const http = require(isSsl ? 'https' : 'http');
|
const http = require(isSsl ? 'https' : 'http');
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue