forked from davidbierbauer/simplesite
-
Notifications
You must be signed in to change notification settings - Fork 1
/
main.js
44 lines (38 loc) · 1.27 KB
/
main.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
const log = require("ringo/logging").getLogger(module.id);
const engine = require("ringo/engine");
const config = require("./config");
// the HTTP server itself
const httpServer = require("ringo/httpserver");
let server = null;
const stop = exports.stop = function() {
if (server !== null) {
server.stop();
}
};
const init = exports.init = function() {
log.info("Configuring the httpserver ...");
// configure the server
server = httpServer.build()
.serveApplication("/", module.resolve("./webapp"), {
"virtualHosts": config.get("server:vhosts")
})
.http({
"host": config.get("server:http:host"),
"port": config.get("server:http:port")
});
if (config.get("server:https:port")) {
server.https({
"host": config.get("server:https:host"),
"port": config.get("server:https:port"),
"keyStore": config.get("server:https:keyStore"),
"keyStorePassword": config.get("server:https:keyStorePassword"),
"keyManagerPassword": config.get("server:https:keyManagerPassword"),
"includeCipherSuites": config.get("server:https:includeCipherSuites")
})
}
log.info("Starting application simplesite ...");
server.start();
};
if (require.main === module) {
init();
}