ab-livereload/build/livereload.js
Asif Bacchus 8f35aaef11 feature: allow non-secure connections
- default to secure
- parameterize via env var
2021-07-23 13:31:01 -06:00

30 lines
648 B
JavaScript

// implement node-livereload over an HTTPS connection
// load livereload module
let livereload = require('livereload');
// set createServer options
const fs = require('fs');
const options = {
port: process.env.LR_PORT,
exts: process.env.LR_EXTS,
exclusions: process.env.LR_EXCLUDE,
usePolling: true,
delay: process.env.LR_DELAY,
debug: process.env.LR_DEBUG
};
if (process.env.LR_HTTPS) {
options.https = {
cert: fs.readFileSync('/certs/fullchain.pem'),
key: fs.readFileSync('/certs/privkey.pem')
};
}
// start server
let server = livereload.createServer(options);
server.watch('/watch')
//#EOF