Merge pull request #4793 from Infisical/disable-gateway-health-alerts

disabled email notifications for gateway and relay health check
This commit is contained in:
Andre
2025-11-01 02:55:44 -04:00
committed by GitHub
2 changed files with 24 additions and 21 deletions
@@ -25,7 +25,7 @@ import { KmsDataKey } from "@app/services/kms/kms-types";
import { TNotificationServiceFactory } from "@app/services/notification/notification-service"; import { TNotificationServiceFactory } from "@app/services/notification/notification-service";
import { NotificationType } from "@app/services/notification/notification-types"; import { NotificationType } from "@app/services/notification/notification-types";
import { TOrgDALFactory } from "@app/services/org/org-dal"; import { TOrgDALFactory } from "@app/services/org/org-dal";
import { SmtpTemplates, TSmtpService } from "@app/services/smtp/smtp-service"; import { TSmtpService } from "@app/services/smtp/smtp-service";
import { TLicenseServiceFactory } from "../license/license-service"; import { TLicenseServiceFactory } from "../license/license-service";
import { PamResource } from "../pam-resource/pam-resource-enums"; import { PamResource } from "../pam-resource/pam-resource-enums";
@@ -61,8 +61,7 @@ export const gatewayV2ServiceFactory = ({
relayDAL, relayDAL,
permissionService, permissionService,
orgDAL, orgDAL,
notificationService, notificationService
smtpService
}: TGatewayV2ServiceFactoryDep) => { }: TGatewayV2ServiceFactoryDep) => {
const $validateIdentityAccessToGateway = async (orgId: string, actorId: string, actorAuthMethod: ActorAuthMethod) => { const $validateIdentityAccessToGateway = async (orgId: string, actorId: string, actorAuthMethod: ActorAuthMethod) => {
const orgLicensePlan = await licenseService.getPlan(orgId); const orgLicensePlan = await licenseService.getPlan(orgId);
@@ -931,15 +930,17 @@ export const gatewayV2ServiceFactory = ({
})) }))
); );
await smtpService.sendMail({ // Temporarily disabled email notifications due to excessive noise. Will be revised later
recipients: admins.map((admin) => admin.user.email).filter((v): v is string => !!v), //
subjectLine: "Gateway Health Alert", // await smtpService.sendMail({
substitutions: { // recipients: admins.map((admin) => admin.user.email).filter((v): v is string => !!v),
type: "gateway", // subjectLine: "Gateway Health Alert",
names: gatewayNames // substitutions: {
}, // type: "gateway",
template: SmtpTemplates.HealthAlert // names: gatewayNames
}); // },
// template: SmtpTemplates.HealthAlert
// });
await Promise.all(gateways.map((gw) => gatewayV2DAL.updateById(gw.id, { healthAlertedAt: new Date() }))); await Promise.all(gateways.map((gw) => gatewayV2DAL.updateById(gw.id, { healthAlertedAt: new Date() })));
} catch (error) { } catch (error) {
+11 -9
View File
@@ -1268,15 +1268,17 @@ export const relayServiceFactory = ({
})) }))
); );
await smtpService.sendMail({ // Temporarily disabled email notifications due to excessive noise. Will be revised later
recipients: admins.map((admin) => admin.user.email).filter((v): v is string => !!v), //
subjectLine: "Relay Health Alert", // await smtpService.sendMail({
substitutions: { // recipients: admins.map((admin) => admin.user.email).filter((v): v is string => !!v),
type: "relay", // subjectLine: "Relay Health Alert",
names: relayNames // substitutions: {
}, // type: "relay",
template: SmtpTemplates.HealthAlert // names: relayNames
}); // },
// template: SmtpTemplates.HealthAlert
// });
} }
await Promise.all(relays.map((r) => relayDAL.updateById(r.id, { healthAlertedAt: new Date() }))); await Promise.all(relays.map((r) => relayDAL.updateById(r.id, { healthAlertedAt: new Date() })));