Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion normalize.js
Original file line number Diff line number Diff line change
Expand Up @@ -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),
Expand Down
2 changes: 2 additions & 0 deletions readme.md
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Comment thread
mgrinberg-sanborn marked this conversation as resolved.

### As a CLI

Point the `stillalive` command at a JSON config file:
Expand Down
4 changes: 3 additions & 1 deletion server.js
Original file line number Diff line number Diff line change
Expand Up @@ -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);

Expand Down