wildduck/server.js

30 lines
750 B
JavaScript
Raw Normal View History

2017-03-06 05:45:50 +08:00
'use strict';
2017-03-06 22:13:40 +08:00
let config = require('config');
let log = require('npmlog');
let imap = require('./imap');
let lmtp = require('./lmtp');
let api = require('./api');
2017-03-06 05:45:50 +08:00
log.level = config.log.level;
2017-03-06 22:13:40 +08:00
imap((err, imap) => {
2017-03-06 05:45:50 +08:00
if (err) {
2017-03-06 22:13:40 +08:00
log.error('App', 'Failed to start IMAP server');
return process.exit(1);
2017-03-06 05:45:50 +08:00
}
2017-03-06 22:13:40 +08:00
lmtp(imap, err => {
if (err) {
log.error('App', 'Failed to start LMTP server');
return process.exit(1);
}
api(imap, err => {
2017-03-06 05:45:50 +08:00
if (err) {
2017-03-06 22:13:40 +08:00
log.error('App', 'Failed to start API server');
return process.exit(1);
2017-03-06 05:45:50 +08:00
}
2017-03-06 22:13:40 +08:00
log.info('App', 'All servers started, ready to process some mail');
2017-03-06 05:45:50 +08:00
});
2017-03-06 22:13:40 +08:00
});
2017-03-06 05:45:50 +08:00
});