2012-04-20 22:40:33 +02:00
|
|
|
#!/usr/bin/env node
|
2011-03-26 15:52:56 +01:00
|
|
|
/**
|
2011-05-30 16:53:11 +02:00
|
|
|
* This module is started with bin/run.sh. It sets up a Express HTTP and a Socket.IO Server.
|
|
|
|
* Static file Requests are answered directly from this module, Socket.IO messages are passed
|
|
|
|
* to MessageHandler and minfied requests are passed to minified.
|
|
|
|
*/
|
|
|
|
|
|
|
|
/*
|
2011-08-11 16:26:41 +02:00
|
|
|
* 2011 Peter 'Pita' Martischka (Primary Technology Ltd)
|
2011-03-26 15:52:56 +01:00
|
|
|
*
|
|
|
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
|
|
* you may not use this file except in compliance with the License.
|
|
|
|
* You may obtain a copy of the License at
|
|
|
|
*
|
|
|
|
* http://www.apache.org/licenses/LICENSE-2.0
|
|
|
|
*
|
|
|
|
* Unless required by applicable law or agreed to in writing, software
|
|
|
|
* distributed under the License is distributed on an "AS-IS" BASIS,
|
|
|
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
|
|
* See the License for the specific language governing permissions and
|
|
|
|
* limitations under the License.
|
|
|
|
*/
|
2011-03-26 14:10:41 +01:00
|
|
|
|
2011-08-03 20:31:25 +02:00
|
|
|
var log4js = require('log4js');
|
2011-07-27 19:52:23 +02:00
|
|
|
var settings = require('./utils/Settings');
|
|
|
|
var db = require('./db/DB');
|
2011-05-19 18:36:26 +02:00
|
|
|
var async = require('async');
|
2012-03-01 19:00:58 +01:00
|
|
|
var plugins = require("ep_etherpad-lite/static/js/pluginfw/plugins");
|
|
|
|
var hooks = require("ep_etherpad-lite/static/js/pluginfw/hooks");
|
2012-02-26 14:14:54 +01:00
|
|
|
var npm = require("npm/lib/npm.js");
|
2011-05-19 18:36:26 +02:00
|
|
|
|
2011-06-30 21:03:09 +02:00
|
|
|
|
2011-08-17 18:45:47 +02:00
|
|
|
//set loglevel
|
|
|
|
log4js.setGlobalLogLevel(settings.loglevel);
|
|
|
|
|
2011-05-14 19:57:07 +02:00
|
|
|
async.waterfall([
|
2012-02-24 23:38:37 +01:00
|
|
|
//initalize the database
|
|
|
|
function (callback)
|
|
|
|
{
|
|
|
|
db.init(callback);
|
|
|
|
},
|
|
|
|
|
2012-02-24 17:59:14 +01:00
|
|
|
plugins.update,
|
|
|
|
|
2012-02-24 20:45:02 +01:00
|
|
|
function (callback) {
|
2012-04-20 22:44:10 +02:00
|
|
|
console.info("Installed plugins: " + plugins.formatPlugins());
|
|
|
|
console.debug("Installed parts:\n" + plugins.formatParts());
|
|
|
|
console.debug("Installed hooks:\n" + plugins.formatHooks());
|
2012-07-25 10:58:30 +02:00
|
|
|
|
|
|
|
// Call loadSettings hook
|
|
|
|
hooks.aCallAll("loadSettings", { settings: settings });
|
|
|
|
|
2012-02-24 20:45:02 +01:00
|
|
|
callback();
|
|
|
|
},
|
|
|
|
|
2011-05-19 18:36:26 +02:00
|
|
|
//initalize the http server
|
2011-05-14 19:57:07 +02:00
|
|
|
function (callback)
|
2011-03-26 14:10:41 +01:00
|
|
|
{
|
2012-07-03 23:30:40 +02:00
|
|
|
hooks.callAll("createServer", {});
|
2011-05-14 19:57:07 +02:00
|
|
|
callback(null);
|
2011-03-26 14:10:41 +01:00
|
|
|
}
|
2011-05-14 19:57:07 +02:00
|
|
|
]);
|