diff --git a/normalize.js b/normalize.js index 3326bf9..4c35c55 100644 --- a/normalize.js +++ b/normalize.js @@ -66,8 +66,10 @@ const parseAddressList = (input) => { // a single normalized object, so the mappers never have to re-handle shorthand. const normalizeEmail = (email) => { email = email || {}; + const from = email.from || (email.from_email ? { email: email.from_email, name: email.from_name } : undefined); + return { - from: parseAddress(email.from), + from: parseAddress(from), to: parseAddressList(email.to), cc: parseAddressList(email.cc), bcc: parseAddressList(email.bcc), diff --git a/readme.md b/readme.md index 39f9493..9a2ca57 100644 --- a/readme.md +++ b/readme.md @@ -47,6 +47,8 @@ app.get('/health', (_req, res) => { `port` is optional and defaults to `process.env.PORT`, then `3000`. +If you don't want it to automatically listen, pass false as a port. + ### As a CLI Point the `stillalive` command at a JSON config file: diff --git a/server.js b/server.js index f6b58cb..3fb0fbf 100644 --- a/server.js +++ b/server.js @@ -115,7 +115,9 @@ export default async function createServer(key, emailConfig, listenPort) { })); res.json({ active }); }); - + if (listenPort === false) { + return app; + } console.log(`app is listening on ${port}`); app.listen(port);