mirror of
https://github.com/Abdulazizzn/n8n-enterprise-unlocked.git
synced 2025-12-20 11:22:15 +00:00
fix(cli): initialize mailer just if connection can be verified (#3997)
This commit is contained in:
@@ -1,6 +1,6 @@
|
|||||||
import Handlebars from 'handlebars';
|
|
||||||
import { existsSync } from 'fs';
|
import { existsSync } from 'fs';
|
||||||
import { readFile } from 'fs/promises';
|
import { readFile } from 'fs/promises';
|
||||||
|
import Handlebars from 'handlebars';
|
||||||
import { join as pathJoin } from 'path';
|
import { join as pathJoin } from 'path';
|
||||||
// eslint-disable-next-line import/no-cycle
|
// eslint-disable-next-line import/no-cycle
|
||||||
import { GenericHelpers } from '../..';
|
import { GenericHelpers } from '../..';
|
||||||
@@ -90,7 +90,12 @@ let mailerInstance: UserManagementMailer | undefined;
|
|||||||
export async function getInstance(): Promise<UserManagementMailer> {
|
export async function getInstance(): Promise<UserManagementMailer> {
|
||||||
if (mailerInstance === undefined) {
|
if (mailerInstance === undefined) {
|
||||||
mailerInstance = new UserManagementMailer();
|
mailerInstance = new UserManagementMailer();
|
||||||
await mailerInstance.verifyConnection();
|
try {
|
||||||
|
await mailerInstance.verifyConnection();
|
||||||
|
} catch (error) {
|
||||||
|
mailerInstance = undefined;
|
||||||
|
throw error;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
return mailerInstance;
|
return mailerInstance;
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user