make FCM_SERVER_KEY optional in NotificationsService

This commit is contained in:
Lizandro Guarnizo
2026-06-03 23:01:52 -05:00
parent 15794ba073
commit 83508a22f3
@@ -7,10 +7,14 @@ export class NotificationsService {
private readonly fcmServerKey: string; private readonly fcmServerKey: string;
constructor(private config: ConfigService) { constructor(private config: ConfigService) {
this.fcmServerKey = this.config.getOrThrow<string>('FCM_SERVER_KEY'); this.fcmServerKey = this.config.get<string>('FCM_SERVER_KEY', '');
} }
async send(to: string, title: string, body: string, data?: Record<string, any>) { async send(to: string, title: string, body: string, data?: Record<string, any>) {
if (!this.fcmServerKey) {
this.logger.warn('FCM_SERVER_KEY not set, skipping notification');
return;
}
const message = { const message = {
notification: { title, body }, notification: { title, body },
priority: 'high' as const, priority: 'high' as const,