greenlock-cluster.js/examples/serve.js

28 lines
981 B
JavaScript
Raw Permalink Normal View History

"use strict";
2016-08-12 02:55:26 +00:00
var cluster = require("cluster");
2016-08-12 02:55:26 +00:00
var main;
// You'll often see examples where people use cluster
// master and worker all in the same file, which is fine,
// but in order to conserve memory and especially to be
// less confusing, I'm splitting the code into two files
if (cluster.isMaster) {
main = require("./master");
} else {
main = require("./worker");
2016-08-12 02:55:26 +00:00
}
2017-01-25 21:53:56 +00:00
// this is nothing greenlock-cluster specific
2016-08-12 02:55:26 +00:00
// I'm just arbitrarily choosing to share some configuration
// that I know I'm going to use in both places
main.init({
// Depending on the strategy, the whole le-challenge-<<strategy>>
// could be shared between worker and server, but since I'm just
// using using le-challenge-fs (as you'll see), I'm only sharing the webrootPath
webrootPath: require("os").tmpdir() + require("path").sep + "acme-challenge",
2016-08-12 02:55:26 +00:00
// this is used both by node-greenlock (master) and le-sni-auto (worker)
renewWithin: 15 * 24 * 60 * 60 * 1000
2016-08-12 02:55:26 +00:00
});