UNPKG

@cocalc/server

Version:

CoCalc server functionality: functions used by either the hub and the next.js server

30 lines 1.18 kB
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); const settings_1 = require("@cocalc/server/settings"); const node_zendesk_1 = require("node-zendesk"); let client = undefined; let config = ""; async function getClient() { const { zendesk_token: token, zendesk_username: username, zendesk_uri: remoteUri, } = await (0, settings_1.getServerSettings)(); const config0 = `${token + username + remoteUri}`; if (config == config0 && client != null) { return client; } if (client == null) { // Get the credential from the database. if (!token) { throw Error("Support not available -- admin must configure the Zendesk token"); } if (!username) { throw Error("Support not available -- admin must configure the Zendesk username"); } if (!remoteUri) { throw Error("Support not available -- admin must configure the Zendesk Uri"); } config = config0; client = (0, node_zendesk_1.createClient)({ username, token, remoteUri }); } return client; } exports.default = getClient; //# sourceMappingURL=zendesk-client.js.map