Settings.js, express.js: trivial reformatting
Future commits by Tristram Gräbener will modify them.pull/3595/head
parent
dc7e49f89d
commit
75a0f339e1
|
@ -19,20 +19,20 @@ exports.createServer = function () {
|
||||||
exports.restartServer();
|
exports.restartServer();
|
||||||
|
|
||||||
console.log(`You can access your Etherpad instance at http://${settings.ip}:${settings.port}/`);
|
console.log(`You can access your Etherpad instance at http://${settings.ip}:${settings.port}/`);
|
||||||
if(!_.isEmpty(settings.users)){
|
if (!_.isEmpty(settings.users)) {
|
||||||
console.log(`The plugin admin page is at http://${settings.ip}:${settings.port}/admin/plugins`);
|
console.log(`The plugin admin page is at http://${settings.ip}:${settings.port}/admin/plugins`);
|
||||||
}
|
} else {
|
||||||
else{
|
|
||||||
console.warn("Admin username and password not set in settings.json. To access admin please uncomment and edit 'users' in settings.json");
|
console.warn("Admin username and password not set in settings.json. To access admin please uncomment and edit 'users' in settings.json");
|
||||||
}
|
}
|
||||||
|
|
||||||
var env = process.env.NODE_ENV || 'development';
|
var env = process.env.NODE_ENV || 'development';
|
||||||
if(env !== 'production'){
|
|
||||||
|
if (env !== 'production') {
|
||||||
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");
|
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");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
exports.restartServer = function () {
|
exports.restartServer = function () {
|
||||||
|
|
||||||
if (server) {
|
if (server) {
|
||||||
console.log("Restarting express server");
|
console.log("Restarting express server");
|
||||||
server.close();
|
server.close();
|
||||||
|
@ -41,7 +41,6 @@ exports.restartServer = function () {
|
||||||
var app = express(); // New syntax for express v3
|
var app = express(); // New syntax for express v3
|
||||||
|
|
||||||
if (settings.ssl) {
|
if (settings.ssl) {
|
||||||
|
|
||||||
console.log("SSL -- enabled");
|
console.log("SSL -- enabled");
|
||||||
console.log(`SSL -- server key file: ${settings.ssl.key}`);
|
console.log(`SSL -- server key file: ${settings.ssl.key}`);
|
||||||
console.log(`SSL -- Certificate Authority's certificate file: ${settings.ssl.cert}`);
|
console.log(`SSL -- Certificate Authority's certificate file: ${settings.ssl.cert}`);
|
||||||
|
@ -50,9 +49,10 @@ exports.restartServer = function () {
|
||||||
key: fs.readFileSync( settings.ssl.key ),
|
key: fs.readFileSync( settings.ssl.key ),
|
||||||
cert: fs.readFileSync( settings.ssl.cert )
|
cert: fs.readFileSync( settings.ssl.cert )
|
||||||
};
|
};
|
||||||
|
|
||||||
if (settings.ssl.ca) {
|
if (settings.ssl.ca) {
|
||||||
options.ca = [];
|
options.ca = [];
|
||||||
for(var i = 0; i < settings.ssl.ca.length; i++) {
|
for (var i = 0; i < settings.ssl.ca.length; i++) {
|
||||||
var caFileName = settings.ssl.ca[i];
|
var caFileName = settings.ssl.ca[i];
|
||||||
options.ca.push(fs.readFileSync(caFileName));
|
options.ca.push(fs.readFileSync(caFileName));
|
||||||
}
|
}
|
||||||
|
@ -60,16 +60,15 @@ exports.restartServer = function () {
|
||||||
|
|
||||||
var https = require('https');
|
var https = require('https');
|
||||||
server = https.createServer(options, app);
|
server = https.createServer(options, app);
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
|
|
||||||
var http = require('http');
|
var http = require('http');
|
||||||
server = http.createServer(app);
|
server = http.createServer(app);
|
||||||
}
|
}
|
||||||
|
|
||||||
app.use(function (req, res, next) {
|
app.use(function(req, res, next) {
|
||||||
// res.header("X-Frame-Options", "deny"); // breaks embedded pads
|
// res.header("X-Frame-Options", "deny"); // breaks embedded pads
|
||||||
if(settings.ssl){ // if we use SSL
|
if (settings.ssl) {
|
||||||
|
// we use SSL
|
||||||
res.header("Strict-Transport-Security", "max-age=31536000; includeSubDomains");
|
res.header("Strict-Transport-Security", "max-age=31536000; includeSubDomains");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -80,7 +79,7 @@ exports.restartServer = function () {
|
||||||
next();
|
next();
|
||||||
});
|
});
|
||||||
|
|
||||||
if(settings.trustProxy){
|
if (settings.trustProxy) {
|
||||||
app.enable('trust proxy');
|
app.enable('trust proxy');
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -231,60 +231,67 @@ exports.loadTest = false;
|
||||||
exports.indentationOnNewLine = true;
|
exports.indentationOnNewLine = true;
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* log4js appender configuration
|
* log4js appender configuration
|
||||||
*/
|
*/
|
||||||
exports.logconfig = { appenders: [{ type: "console" }]};
|
exports.logconfig = { appenders: [{ type: "console" }]};
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Session Key, do not sure this.
|
* Session Key, do not sure this.
|
||||||
*/
|
*/
|
||||||
exports.sessionKey = false;
|
exports.sessionKey = false;
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Trust Proxy, whether or not trust the x-forwarded-for header.
|
* Trust Proxy, whether or not trust the x-forwarded-for header.
|
||||||
*/
|
*/
|
||||||
exports.trustProxy = false;
|
exports.trustProxy = false;
|
||||||
|
|
||||||
/* This setting is used if you need authentication and/or
|
/*
|
||||||
|
* This setting is used if you need authentication and/or
|
||||||
* authorization. Note: /admin always requires authentication, and
|
* authorization. Note: /admin always requires authentication, and
|
||||||
* either authorization by a module, or a user with is_admin set */
|
* either authorization by a module, or a user with is_admin set
|
||||||
|
*/
|
||||||
exports.requireAuthentication = false;
|
exports.requireAuthentication = false;
|
||||||
exports.requireAuthorization = false;
|
exports.requireAuthorization = false;
|
||||||
exports.users = {};
|
exports.users = {};
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Show settings in admin page, by default it is true
|
* Show settings in admin page, by default it is true
|
||||||
*/
|
*/
|
||||||
exports.showSettingsInAdminPage = true;
|
exports.showSettingsInAdminPage = true;
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* By default, when caret is moved out of viewport, it scrolls the minimum height needed to make this
|
* By default, when caret is moved out of viewport, it scrolls the minimum
|
||||||
* line visible.
|
* height needed to make this line visible.
|
||||||
*/
|
*/
|
||||||
exports.scrollWhenFocusLineIsOutOfViewport = {
|
exports.scrollWhenFocusLineIsOutOfViewport = {
|
||||||
/*
|
/*
|
||||||
* Percentage of viewport height to be additionally scrolled.
|
* Percentage of viewport height to be additionally scrolled.
|
||||||
*/
|
*/
|
||||||
"percentage": {
|
"percentage": {
|
||||||
"editionAboveViewport": 0,
|
"editionAboveViewport": 0,
|
||||||
"editionBelowViewport": 0
|
"editionBelowViewport": 0
|
||||||
},
|
},
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Time (in milliseconds) used to animate the scroll transition. Set to 0 to disable animation
|
* Time (in milliseconds) used to animate the scroll transition. Set to 0 to
|
||||||
*/
|
* disable animation
|
||||||
|
*/
|
||||||
"duration": 0,
|
"duration": 0,
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Flag to control if it should scroll when user places the caret in the last line of the viewport
|
* Percentage of viewport height to be additionally scrolled when user presses arrow up
|
||||||
*/
|
* in the line of the top of the viewport.
|
||||||
/*
|
|
||||||
* Percentage of viewport height to be additionally scrolled when user presses arrow up
|
|
||||||
* in the line of the top of the viewport.
|
|
||||||
*/
|
*/
|
||||||
"percentageToScrollWhenUserPressesArrowUp": 0,
|
"percentageToScrollWhenUserPressesArrowUp": 0,
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Flag to control if it should scroll when user places the caret in the last
|
||||||
|
* line of the viewport
|
||||||
|
*/
|
||||||
"scrollWhenCaretIsInTheLastLineOfViewport": false
|
"scrollWhenCaretIsInTheLastLineOfViewport": false
|
||||||
};
|
};
|
||||||
|
|
||||||
//checks if abiword is avaiable
|
// checks if abiword is avaiable
|
||||||
exports.abiwordAvailable = function()
|
exports.abiwordAvailable = function()
|
||||||
{
|
{
|
||||||
if (exports.abiword != null) {
|
if (exports.abiword != null) {
|
||||||
|
|
Loading…
Reference in New Issue