- Add MorningSummaryService with Zabbix aggregation and adaptive card builder - Add webhook delivery system with Teams incoming webhooks - Add admin UI at /admin/morning-summary for webhook/config management - Add API routes: /send, /test, /webhooks, /webhooks/[id], /config, /history - Register morning-summary cron job in SyncScheduler (Mon-Fri 6:30 AM) - Add outages_only filter (Unavailable triggers only) - Fix host resolution: use getTriggerEnabledHosts to exclude disabled hosts - Fix resolved events: event.get value:1 scoped to window with r_eventid filter - Remove emojis from fact rows and section headers in card - Remove Open Zabbix button (duplicate of View Problems) - Add migrations: morning_summary_config + morning_summaries tables - Add outages_only column to morning_summary_config
42 lines
1.1 KiB
TypeScript
42 lines
1.1 KiB
TypeScript
import { ZoomClient, ZoomClientConfig } from './zoom-client';
|
|
|
|
let zoomClientInstance: ZoomClient | null = null;
|
|
|
|
/**
|
|
* Check if Zoom Server-to-Server OAuth credentials are configured
|
|
*/
|
|
export function isZoomConfigured(): boolean {
|
|
return !!(
|
|
process.env.ZOOM_ACCOUNT_ID &&
|
|
process.env.ZOOM_CLIENT_ID &&
|
|
process.env.ZOOM_CLIENT_SECRET
|
|
);
|
|
}
|
|
|
|
/**
|
|
* Get or create Zoom client singleton
|
|
*/
|
|
export function getZoomClient(): ZoomClient {
|
|
if (!zoomClientInstance) {
|
|
const config: ZoomClientConfig = {
|
|
accountId: process.env.ZOOM_ACCOUNT_ID || '',
|
|
clientId: process.env.ZOOM_CLIENT_ID || '',
|
|
clientSecret: process.env.ZOOM_CLIENT_SECRET || '',
|
|
};
|
|
|
|
if (!config.accountId || !config.clientId || !config.clientSecret) {
|
|
throw new Error(
|
|
'Zoom credentials missing. Set ZOOM_ACCOUNT_ID, ZOOM_CLIENT_ID, and ZOOM_CLIENT_SECRET.'
|
|
);
|
|
}
|
|
|
|
zoomClientInstance = new ZoomClient(config);
|
|
console.log('[ZOOM] Client initialized');
|
|
}
|
|
|
|
return zoomClientInstance;
|
|
}
|
|
|
|
export function resetZoomClient(): void {
|
|
zoomClientInstance = null;
|
|
}
|