wildduck/server.js
2017-03-06 18:27:04 +02:00

36 lines
990 B
JavaScript

'use strict';
let config = require('config');
let log = require('npmlog');
let imap = require('./imap');
let lmtp = require('./lmtp');
let smtp = require('./smtp');
let api = require('./api');
log.level = config.log.level;
imap((err, imap) => {
if (err) {
log.error('App', 'Failed to start IMAP server');
return process.exit(1);
}
lmtp(imap, err => {
if (err) {
log.error('App', 'Failed to start LMTP server');
return process.exit(1);
}
smtp(imap, err => {
if (err) {
log.error('App', 'Failed to start SMTP server');
return process.exit(1);
}
api(imap, err => {
if (err) {
log.error('App', 'Failed to start API server');
return process.exit(1);
}
log.info('App', 'All servers started, ready to process some mail');
});
});
});
});