UNPKG

@coveo/create-atomic

Version:
19 lines (18 loc) 642 B
import 'isomorphic-fetch'; import 'abortcontroller-polyfill'; import { PlatformClient } from '@coveo/platform-client'; import { HttpsProxyAgent } from 'https-proxy-agent'; export function createPlatformClient(host, organizationId, accessToken) { const globalRequestSettings = {}; const proxyServer = process.env.https_proxy || process.env.HTTPS_PROXY; if (proxyServer) { const httpsProxyAgent = new HttpsProxyAgent(proxyServer); globalRequestSettings.agent = httpsProxyAgent; } return new PlatformClient({ globalRequestSettings, organizationId, accessToken, host, }); }