30 lines
648 B
JavaScript
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
|