wulf-pulse/lib/services/addigy-factory.ts
Lorentz Hinrichsen 3c3124d8c9 Restructure: rename to Pulse and move app to root
- Renamed project from PSA-Utils to Pulse
- Moved all app files from autotask-app/ to root
- Updated package.json name to 'pulse'
- Updated Docker container names to pulse-app and pulse-redis
- Updated Docker network name to pulse-network
2025-10-28 23:08:54 -04:00

28 lines
774 B
TypeScript

import { AddigyClient } from './addigy-client';
import { AddigyConfig } from '@/lib/types/addigy';
let cachedAddigyClient: AddigyClient | null = null;
export function getAddigyClient(): AddigyClient {
if (cachedAddigyClient) {
return cachedAddigyClient;
}
const config: AddigyConfig = {
apiUrl: process.env.ADDIGY_API_URL || 'https://api.addigy.com/api/v2',
apiToken: process.env.ADDIGY_API_TOKEN || '',
organizationId: process.env.ADDIGY_ORG_ID,
};
// Validate required config
if (!config.apiToken) {
throw new Error('ADDIGY_API_TOKEN environment variable is required');
}
cachedAddigyClient = new AddigyClient(config);
return cachedAddigyClient;
}
export function clearAddigyClientCache(): void {
cachedAddigyClient = null;
}