mirror of
https://github.com/ether/etherpad-lite.git
synced 2025-05-05 06:37:10 -04:00
added some comments to the server setup to explain what additionalSetup does and why
This commit is contained in:
parent
2fd4789013
commit
23d6369746
1 changed files with 12 additions and 3 deletions
|
@ -68,8 +68,14 @@ exports.maxAge = 1000*60*60*6;
|
||||||
log4js.setGlobalLogLevel(settings.loglevel);
|
log4js.setGlobalLogLevel(settings.loglevel);
|
||||||
|
|
||||||
function init(additionalSetup){
|
function init(additionalSetup){
|
||||||
if("function" != typeof additionalSetup) additionalSetup = function(){};
|
//additionalSetup is an optional argument that must be a function
|
||||||
async.waterfall([
|
//the purpose of additionalSetup is
|
||||||
|
//to allow whoever initializes the server to add functionality
|
||||||
|
//before the server begins listening
|
||||||
|
if("function" != typeof additionalSetup)
|
||||||
|
//the default value for initialSetup is a no-op
|
||||||
|
additionalSetup = function additionalSetup(app, db, managers, handlers){};
|
||||||
|
async.waterfall([
|
||||||
//initalize the database
|
//initalize the database
|
||||||
function (callback)
|
function (callback)
|
||||||
{
|
{
|
||||||
|
@ -414,10 +420,13 @@ async.waterfall([
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
|
//additionalSetup is a hook for modifying the app before it begins listening
|
||||||
|
//some things such a hook might need are the app itself, the database, and any managers and handlers it might want to use
|
||||||
|
//rather than passing the managers and handlers one by one, each of those collections is passed as a dictionary
|
||||||
additionalSetup(
|
additionalSetup(
|
||||||
app, db,
|
app, db,
|
||||||
{
|
{
|
||||||
ro: readOnlyManager,
|
"ro": readOnlyManager,
|
||||||
pad: padManager,
|
pad: padManager,
|
||||||
security: securityManager
|
security: securityManager
|
||||||
},
|
},
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue