greenlock-express.js/single.js

39 lines
903 B
JavaScript
Raw Normal View History

2019-10-27 05:52:19 +00:00
"use strict";
require("./main.js");
var Single = module.exports;
var Servers = require("./servers.js");
Single.create = function(opts) {
2019-11-05 10:09:42 +00:00
var greenlock = require("./greenlock-shim.js").create(opts);
2019-10-27 07:19:44 +00:00
2019-11-01 21:14:07 +00:00
var servers = Servers.create(greenlock);
2019-10-27 05:52:19 +00:00
2019-11-01 21:14:07 +00:00
var single = {
2019-11-03 08:28:37 +00:00
ready: function(fn) {
2019-11-01 21:14:07 +00:00
fn(servers);
return single;
},
master: function(/*fn*/) {
// ignore
//fn(master);
return single;
2019-11-05 18:50:38 +00:00
},
serve: function(fn) {
// keeping backwards compat
if (1 === fn.length) {
single.ready(fn);
return;
}
// serving the app, right away
single.ready(function(glx) {
glx.serveApp(fn);
});
2019-11-01 21:14:07 +00:00
}
};
2019-11-03 08:28:37 +00:00
// backwards compat starts now
single.serve = single.ready;
2019-11-01 21:14:07 +00:00
return single;
2019-10-27 05:52:19 +00:00
};