-
Notifications
You must be signed in to change notification settings - Fork 2
/
app.js
53 lines (41 loc) · 1.18 KB
/
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
43
44
45
46
47
48
49
50
51
52
var util = require('util');
var application = require('./application');
var dataPlugin = require('pomelo-data-plugin');
var createApp = function () {
var app = application;
app.init();
return app;
};
var app = createApp();
// load/watch config file's data
app.use(dataPlugin, {
watcher: {
dir: __dirname + '/config/data',
idx: 'id',
interval: 3000
}
});
var cb = function() {
var npcTalkConf = null
, teamConf = null;
var getConf = function() {
npcTalkConf = app.get('dataService').get('npc_talk');
teamConf = app.get('dataService').get('team');
};
var printConf = function() {
console.warn('\n', (new Date()).getTime(), ': npcTalkConf = ', util.inspect(npcTalkConf, {showHidden: true, depth: null}))
console.warn('\n', (new Date()).getTime(), ': teamConf = ', util.inspect(teamConf, {showHidden: true, depth: null}))
console.warn('==============================================');
};
getConf();
printConf();
setInterval(function() {
getConf();
printConf(); }, 5000);
};
//start
app.start(cb);
// Uncaught exception handler
process.on('uncaughtException', function(err) {
console.error(' Caught exception: ' + err.stack);
});