cal/lib/serverConfig.ts
Alex Johansson f63aa5d550
add linting in CI + fix lint errors (#473)
* run `yarn lint --fix`

* Revert "Revert "add linting to ci""

This reverts commit 0bbbbee4be.

* Fixed some errors

* remove unused code - not sure why this was here?

* assert env var

* more type fixes

* fix typings og gcal callback - needs testing

* rename `md5.ts` to `md5.js`

it is js.

* fix types

* fix types

* fix lint errors

* fix last lint error

Co-authored-by: Alex van Andel <me@alexvanandel.com>
2021-08-19 14:27:01 +02:00

32 lines
664 B
TypeScript

function detectTransport(): string | any {
if (process.env.EMAIL_SERVER) {
return process.env.EMAIL_SERVER;
}
if (process.env.EMAIL_SERVER_HOST) {
const port = parseInt(process.env.EMAIL_SERVER_PORT);
const transport = {
host: process.env.EMAIL_SERVER_HOST,
port,
auth: {
user: process.env.EMAIL_SERVER_USER,
pass: process.env.EMAIL_SERVER_PASSWORD,
},
secure: port === 465,
};
return transport;
}
return {
sendmail: true,
newline: "unix",
path: "/usr/sbin/sendmail",
};
}
export const serverConfig = {
transport: detectTransport(),
from: process.env.EMAIL_FROM,
};