summaryrefslogtreecommitdiff
path: root/src/node
diff options
context:
space:
mode:
authorIván Eixarch <miao.org@gmail.com>2012-11-26 02:21:18 +0100
committerIván Eixarch <miao.org@gmail.com>2012-11-26 02:21:18 +0100
commit460200981e50081be94db0ad31d563d509b8861a (patch)
treef2f0aace8607073811d9f09cd3564710d2367fb9 /src/node
parent0250f8d55c4c57d623cc201c7c774755e7b0d6ae (diff)
parentde5a90b9c78582b272c905674941d36fceb8750f (diff)
downloadetherpad-lite-460200981e50081be94db0ad31d563d509b8861a.zip
Merge remote branch 'ether/develop'
Diffstat (limited to 'src/node')
-rw-r--r--src/node/hooks/express.js24
-rw-r--r--src/node/utils/Settings.js7
2 files changed, 29 insertions, 2 deletions
diff --git a/src/node/hooks/express.js b/src/node/hooks/express.js
index 1900a86a..2bbb5eec 100644
--- a/src/node/hooks/express.js
+++ b/src/node/hooks/express.js
@@ -1,5 +1,4 @@
var hooks = require("ep_etherpad-lite/static/js/pluginfw/hooks");
-var http = require('http');
var express = require('express');
var settings = require('../utils/Settings');
var fs = require('fs');
@@ -50,7 +49,28 @@ exports.restartServer = function () {
}
var app = express(); // New syntax for express v3
- server = http.createServer(app);
+
+ if (settings.ssl) {
+
+ console.log( "SSL -- enabled");
+ console.log( "SSL -- server key file: " + settings.ssl.key );
+ console.log( "SSL -- Certificate Authority's certificate file: " + settings.ssl.cert );
+
+ options = {
+ key: fs.readFileSync( settings.ssl.key ),
+ cert: fs.readFileSync( settings.ssl.cert )
+ };
+
+ var https = require('https');
+ server = https.createServer(options, app);
+
+ } else {
+
+ console.log( "SSL -- not enabled!" );
+
+ var http = require('http');
+ server = http.createServer(app);
+ }
app.use(function (req, res, next) {
res.header("Server", serverName);
diff --git a/src/node/utils/Settings.js b/src/node/utils/Settings.js
index 2ed76d0b..9caa2b0b 100644
--- a/src/node/utils/Settings.js
+++ b/src/node/utils/Settings.js
@@ -48,6 +48,13 @@ exports.ip = "0.0.0.0";
* The Port ep-lite should listen to
*/
exports.port = process.env.PORT || 9001;
+
+/**
+ * The SSL signed server key and the Certificate Authority's own certificate
+ * default case: ep-lite does *not* use SSL. A signed server key is not required in this case.
+ */
+exports.ssl = false;
+
/*
* The Type of the database
*/