-
Notifications
You must be signed in to change notification settings - Fork 6
/
Copy pathapp.js
42 lines (33 loc) · 870 Bytes
/
app.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
/*jslint node: true */
/* global __mods */
'use strict';
process.env.TZ = 'UTC';
var fs = require('fs');
var _ = require('underscore');
process.chdir(__dirname);
/*
var access = fs.createWriteStream('/console.log', { flags: 'a' });
process.stdout.pipe(access);
process.stderr.pipe(access);
*/
var path = require('path');
global.__top = process.cwd();
global.__mods = {};
__mods.config = require("./core/config");
var config = __mods.config;
// Load all mods
_.each(config.masterModules, function(module, moduleName) {
var filename = path.join(process.cwd(), module.dir, "server", "index.js");
if (fs.existsSync(filename)) {
__mods[moduleName] = require(filename);
}
});
// Init all mods
for (var m in __mods) {
if ( (__mods.hasOwnProperty(m))&&
(typeof __mods[m] === "object")&&
(typeof __mods[m].init === "function"))
{
__mods[m].init();
}
}