forked from haraka/Haraka
-
Notifications
You must be signed in to change notification settings - Fork 0
/
haraka.js
39 lines (31 loc) · 957 Bytes
/
haraka.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
#!/usr/bin/env node
"use strict";
var path = require('path');
// this must be set before "server.js" is loaded
process.env.HARAKA = process.env.HARAKA || path.resolve('.');
try {
require.paths.push(path.join(process.env.HARAKA, 'node_modules'));
}
catch(e) {
process.env.NODE_PATH = ':' path.join(process.env.HARAKA, 'node_modules');
}
var fs = require('fs');
var logger = require('./logger');
var server = require('./server');
exports.version = JSON.parse(
fs.readFileSync(path.join(__dirname, './package.json'), 'utf8')
).version;
process.on('uncaughtException', function (err) {
if (err.stack) {
err.stack.split("\n").forEach(function (line) {
logger.logcrit(line);
});
}
else {
logger.logcrit('Caught exception: ' err);
}
logger.dump_logs();
process.exit();
});
logger.log("INFO", "Starting up Haraka version " exports.version);
server.createServer();