mirror of
https://github.com/ether/etherpad-lite.git
synced 2025-05-04 22:27:10 -04:00
basic support for cloudfoundry.
Add - Entry point server.js - Load port and mysql configuraion from env variable - Tunable polling duration
This commit is contained in:
parent
7e4bba0e31
commit
95f1992e4d
4 changed files with 44 additions and 1 deletions
|
@ -420,6 +420,8 @@ async.waterfall([
|
||||||
//we should remove this when the new socket.io version is more stable
|
//we should remove this when the new socket.io version is more stable
|
||||||
io.set('transports', ['xhr-polling']);
|
io.set('transports', ['xhr-polling']);
|
||||||
|
|
||||||
|
io.set('polling duration', settings.pollingDuration)
|
||||||
|
|
||||||
var socketIOLogger = log4js.getLogger("socket.io");
|
var socketIOLogger = log4js.getLogger("socket.io");
|
||||||
io.set('logger', {
|
io.set('logger', {
|
||||||
debug: function (str)
|
debug: function (str)
|
||||||
|
|
|
@ -57,6 +57,11 @@ exports.abiword = null;
|
||||||
*/
|
*/
|
||||||
exports.loglevel = "INFO";
|
exports.loglevel = "INFO";
|
||||||
|
|
||||||
|
/**
|
||||||
|
* xhr-polling duration
|
||||||
|
*/
|
||||||
|
exports.pollingDuration = 20;
|
||||||
|
|
||||||
//read the settings sync
|
//read the settings sync
|
||||||
var settingsStr = fs.readFileSync("../settings.json").toString();
|
var settingsStr = fs.readFileSync("../settings.json").toString();
|
||||||
|
|
||||||
|
@ -97,3 +102,31 @@ for(var i in settings)
|
||||||
console.warn("This setting doesn't exist or it was removed");
|
console.warn("This setting doesn't exist or it was removed");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// If deployed in CloudFoundry
|
||||||
|
if(process.env.VCAP_APP_PORT) {
|
||||||
|
exports.port = process.env.VCAP_APP_PORT
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
// use mysql if provided.
|
||||||
|
var vcap_services = process.env.VCAP_SERVICES;
|
||||||
|
|
||||||
|
if(vcap_services) {
|
||||||
|
var svcs = JSON.parse(vcap_services)
|
||||||
|
for(var key in svcs ) {
|
||||||
|
var svc = svcs[key]
|
||||||
|
console.log("service:" + svc)
|
||||||
|
if( key.match(/^mysql/) ) {
|
||||||
|
exports.dbType= "mysql";
|
||||||
|
var cred = svc[0].credentials
|
||||||
|
exports.dbSettings = {
|
||||||
|
"user" : cred.user ,
|
||||||
|
"host" : cred.host ,
|
||||||
|
"password" : cred.password ,
|
||||||
|
"database" : cred.name ,
|
||||||
|
};
|
||||||
|
}
|
||||||
|
console.debug("database setup:" + console.dir(exports.dbSettings))
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
5
server.js
Normal file
5
server.js
Normal file
|
@ -0,0 +1,5 @@
|
||||||
|
// Entry point for etherpad running on cloudfoundry
|
||||||
|
var path = require('path')
|
||||||
|
process.chdir( path.join( process.cwd(), 'node'))
|
||||||
|
|
||||||
|
var s = require("./node/server")
|
|
@ -37,5 +37,8 @@
|
||||||
"abiword" : null,
|
"abiword" : null,
|
||||||
|
|
||||||
/* The log level we are using, can be: DEBUG, INFO, WARN, ERROR */
|
/* The log level we are using, can be: DEBUG, INFO, WARN, ERROR */
|
||||||
"loglevel": "INFO"
|
"loglevel": "INFO",
|
||||||
|
|
||||||
|
/* The xhr-polling duration, default value is 20. */
|
||||||
|
"pollingDuration" : 20
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue