wulf-pulse/lib/services/autotask-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

26 lines
845 B
TypeScript

import { AutotaskClient } from './autotask-client';
import { AutotaskConfig } from '@/lib/types/autotask';
let clientInstance: AutotaskClient | null = null;
export function getAutotaskClient(): AutotaskClient {
if (!clientInstance) {
const config: AutotaskConfig = {
apiUrl: process.env.AUTOTASK_API_URL || '',
username: process.env.AUTOTASK_USERNAME || '',
password: process.env.AUTOTASK_SECRET || '',
apiIntegrationCode: process.env.AUTOTASK_API_INTEGRATION_CODE || '',
};
// Validate configuration
if (!config.apiUrl || !config.username || !config.password || !config.apiIntegrationCode) {
throw new Error(
'Missing Autotask API configuration. Please check your environment variables.'
);
}
clientInstance = new AutotaskClient(config);
}
return clientInstance;
}