-
Notifications
You must be signed in to change notification settings - Fork 0
/
index.js
38 lines (30 loc) · 992 Bytes
/
index.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
const Smtp = require('./lib/smtp.js');
const Httpd = require('./lib/httpd.js');
const Logger = require('bunyan');
const log = new Logger({name: "mail-drop"});
const yargs = require('yargs')
.alias('r', 'redis-db')
.describe('r', 'which Redis Database # to use?')
.default('r', 9)
.alias('h', 'redis-host')
.describe('h', 'Redis hostname')
.default('h', "127.0.0.1")
.alias('d', 'domain')
.describe('d', 'Domain to Accept Emails for')
.default('d', 'seasoned.pizza')
.alias('p', 'httpd-port')
.describe('p', 'what port to listen to for HTTPD')
.default('p', 80)
.help('help')
.parse();
const config ={
domain: yargs.d,
redis: {
hostname: yargs.h,
database: yargs.r
},
httpd:{ port: yargs.p }
};
log.info(`Starting Mail Drop for ${config['domain']}`,{configuration: config});
const smtp = Smtp(config, new Logger({name: 'mail-smtp'}));
const httpd = Httpd(config, new Logger({name: 'mail-http'}));