File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -23,3 +23,12 @@ export function storageExists(): boolean {
2323 return false
2424 }
2525}
26+
27+ /**
28+ * Check if mail is enabled
29+ */
30+ export function mailExists ( ) : boolean {
31+ return Boolean (
32+ env . MAIL_HOST && env . MAIL_PORT && env . MAIL_USERNAME && env . MAIL_PASSWORD && env . MAIL_FROM
33+ )
34+ }
Original file line number Diff line number Diff line change 1+ import { green } from 'colorette'
2+ import fs from 'fs'
3+ import * as fsAsync from 'fs/promises'
4+ import { logger } from '~/config/logger'
5+
6+ const msgType = `${ green ( 'filesystem' ) } `
7+
8+ /**
9+ * Read HTML file
10+ * @param filePath - path to HTML file
11+ * @returns HTML file content
12+ */
13+ export async function readHTMLFile (
14+ filePath : fs . PathLike | fs . promises . FileHandle
15+ ) : Promise < string > {
16+ try {
17+ return await fsAsync . readFile ( filePath , 'utf-8' )
18+ } catch ( err ) {
19+ logger . error ( `${ msgType } - invalid HTML file path: ${ filePath } ` )
20+ throw new Error ( `invalid HTML file path: ${ filePath } ` )
21+ }
22+ }
You can’t perform that action at this time.
0 commit comments