Skip to content

Commit 75a0f33

Browse files
committed
Settings.js, express.js: trivial reformatting
Future commits by Tristram Gräbener will modify them.
1 parent dc7e49f commit 75a0f33

File tree

2 files changed

+41
-35
lines changed

2 files changed

+41
-35
lines changed

src/node/hooks/express.js

Lines changed: 11 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -19,20 +19,20 @@ exports.createServer = function () {
1919
exports.restartServer();
2020

2121
console.log(`You can access your Etherpad instance at http://${settings.ip}:${settings.port}/`);
22-
if(!_.isEmpty(settings.users)){
22+
if (!_.isEmpty(settings.users)) {
2323
console.log(`The plugin admin page is at http://${settings.ip}:${settings.port}/admin/plugins`);
24-
}
25-
else{
24+
} else {
2625
console.warn("Admin username and password not set in settings.json. To access admin please uncomment and edit 'users' in settings.json");
2726
}
27+
2828
var env = process.env.NODE_ENV || 'development';
29-
if(env !== 'production'){
29+
30+
if (env !== 'production') {
3031
console.warn("Etherpad is running in Development mode. This mode is slower for users and less secure than production mode. You should set the NODE_ENV environment variable to production by using: export NODE_ENV=production");
3132
}
3233
}
3334

3435
exports.restartServer = function () {
35-
3636
if (server) {
3737
console.log("Restarting express server");
3838
server.close();
@@ -41,7 +41,6 @@ exports.restartServer = function () {
4141
var app = express(); // New syntax for express v3
4242

4343
if (settings.ssl) {
44-
4544
console.log("SSL -- enabled");
4645
console.log(`SSL -- server key file: ${settings.ssl.key}`);
4746
console.log(`SSL -- Certificate Authority's certificate file: ${settings.ssl.cert}`);
@@ -50,26 +49,26 @@ exports.restartServer = function () {
5049
key: fs.readFileSync( settings.ssl.key ),
5150
cert: fs.readFileSync( settings.ssl.cert )
5251
};
52+
5353
if (settings.ssl.ca) {
5454
options.ca = [];
55-
for(var i = 0; i < settings.ssl.ca.length; i++) {
55+
for (var i = 0; i < settings.ssl.ca.length; i++) {
5656
var caFileName = settings.ssl.ca[i];
5757
options.ca.push(fs.readFileSync(caFileName));
5858
}
5959
}
6060

6161
var https = require('https');
6262
server = https.createServer(options, app);
63-
6463
} else {
65-
6664
var http = require('http');
6765
server = http.createServer(app);
6866
}
6967

70-
app.use(function (req, res, next) {
68+
app.use(function(req, res, next) {
7169
// res.header("X-Frame-Options", "deny"); // breaks embedded pads
72-
if(settings.ssl){ // if we use SSL
70+
if (settings.ssl) {
71+
// we use SSL
7372
res.header("Strict-Transport-Security", "max-age=31536000; includeSubDomains");
7473
}
7574

@@ -80,7 +79,7 @@ exports.restartServer = function () {
8079
next();
8180
});
8281

83-
if(settings.trustProxy){
82+
if (settings.trustProxy) {
8483
app.enable('trust proxy');
8584
}
8685

src/node/utils/Settings.js

Lines changed: 30 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -231,60 +231,67 @@ exports.loadTest = false;
231231
exports.indentationOnNewLine = true;
232232

233233
/*
234-
* log4js appender configuration
235-
*/
234+
* log4js appender configuration
235+
*/
236236
exports.logconfig = { appenders: [{ type: "console" }]};
237237

238238
/*
239-
* Session Key, do not sure this.
240-
*/
239+
* Session Key, do not sure this.
240+
*/
241241
exports.sessionKey = false;
242242

243243
/*
244-
* Trust Proxy, whether or not trust the x-forwarded-for header.
245-
*/
244+
* Trust Proxy, whether or not trust the x-forwarded-for header.
245+
*/
246246
exports.trustProxy = false;
247247

248-
/* This setting is used if you need authentication and/or
248+
/*
249+
* This setting is used if you need authentication and/or
249250
* authorization. Note: /admin always requires authentication, and
250-
* either authorization by a module, or a user with is_admin set */
251+
* either authorization by a module, or a user with is_admin set
252+
*/
251253
exports.requireAuthentication = false;
252254
exports.requireAuthorization = false;
253255
exports.users = {};
254256

255257
/*
256-
* Show settings in admin page, by default it is true
257-
*/
258+
* Show settings in admin page, by default it is true
259+
*/
258260
exports.showSettingsInAdminPage = true;
259261

260262
/*
261-
* By default, when caret is moved out of viewport, it scrolls the minimum height needed to make this
262-
* line visible.
263-
*/
263+
* By default, when caret is moved out of viewport, it scrolls the minimum
264+
* height needed to make this line visible.
265+
*/
264266
exports.scrollWhenFocusLineIsOutOfViewport = {
265267
/*
266-
* Percentage of viewport height to be additionally scrolled.
267-
*/
268+
* Percentage of viewport height to be additionally scrolled.
269+
*/
268270
"percentage": {
269271
"editionAboveViewport": 0,
270272
"editionBelowViewport": 0
271273
},
274+
272275
/*
273-
* Time (in milliseconds) used to animate the scroll transition. Set to 0 to disable animation
274-
*/
276+
* Time (in milliseconds) used to animate the scroll transition. Set to 0 to
277+
* disable animation
278+
*/
275279
"duration": 0,
280+
276281
/*
277-
* Flag to control if it should scroll when user places the caret in the last line of the viewport
278-
*/
279-
/*
280-
* Percentage of viewport height to be additionally scrolled when user presses arrow up
281-
* in the line of the top of the viewport.
282+
* Percentage of viewport height to be additionally scrolled when user presses arrow up
283+
* in the line of the top of the viewport.
282284
*/
283285
"percentageToScrollWhenUserPressesArrowUp": 0,
286+
287+
/*
288+
* Flag to control if it should scroll when user places the caret in the last
289+
* line of the viewport
290+
*/
284291
"scrollWhenCaretIsInTheLastLineOfViewport": false
285292
};
286293

287-
//checks if abiword is avaiable
294+
// checks if abiword is avaiable
288295
exports.abiwordAvailable = function()
289296
{
290297
if (exports.abiword != null) {

0 commit comments

Comments
 (0)