-
Notifications
You must be signed in to change notification settings - Fork 67
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Refactor: Convert TODO Comments Into Issues (#1262)
* refactor: make sender configurable * fix: throw an error if operating system is unkown * refactor: move todo to #1260 * refactor: todo has been covered by #1229 * refactor: separate function due to bad abstraction * docs: fix typo and error example * test: remove failed test
- Loading branch information
1 parent
3d2380c
commit 4e5e2b2
Showing
14 changed files
with
120 additions
and
99 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -26,6 +26,7 @@ import * as nodemailer from 'nodemailer' | |
import Mailgen from 'mailgen' | ||
import Joi from 'joi' | ||
|
||
import { getSender } from '../utils/default-sender' | ||
import type { NotificationMessage } from '.' | ||
|
||
type NotificationData = { | ||
|
@@ -51,8 +52,7 @@ export const send = async ( | |
{ hostname, password, port, recipients, username }: NotificationData, | ||
{ body, subject }: NotificationMessage | ||
): Promise<void> => { | ||
// TODO: Read from ENV Variables | ||
const DEFAULT_EMAIL = '[email protected]' | ||
const DEFAULT_EMAIL = getSender().email | ||
const DEFAULT_SENDER_NAME = 'Monika' | ||
const transporter = nodemailer.createTransport({ | ||
host: hostname, | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
type Sender = { | ||
name: string | ||
email: string | ||
} | ||
|
||
export type InputSender = Partial<Sender> | ||
|
||
let defaultSender: Sender = { | ||
name: 'Monika', | ||
email: '[email protected]', | ||
} | ||
|
||
export function getSender(): Sender { | ||
return defaultSender | ||
} | ||
|
||
export function updateSender(sender: InputSender) { | ||
defaultSender = { ...defaultSender, ...sender } | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters