Skip to content

Commit d07e23e

Browse files
authored
Use lower request limit if credentials aren't found (#132)
* Use lower request limit if credentials aren't found * Add newline
1 parent dbd675b commit d07e23e

File tree

1 file changed

+10
-5
lines changed

1 file changed

+10
-5
lines changed

_deploy/zendesk.mjs

Lines changed: 10 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,19 @@
11
'use strict';
22

33
// Read environment variables
4+
var authorized = true;
45
const ZENDESK_USER = process.env.ZENDESK_USER;
5-
if (!ZENDESK_USER) {
6-
throw new Error('Missing environment variable: ZENDESK_USER')
7-
}
86
const ZENDESK_PASS = process.env.ZENDESK_PASS;
9-
if (!ZENDESK_USER) {
10-
throw new Error('Missing environment variable: ZENDESK_PASS')
7+
let zendeskApiLimit;
8+
if (ZENDESK_USER && ZENDESK_PASS) {
9+
console.log('Zendesk credentials found.');
10+
zendeskApiLimit = 400;
11+
} else {
12+
console.log('Zendesk credentials not found.');
13+
zendeskApiLimit = 200;
1114
}
15+
console.log(`API requests per minute: ${zendeskApiLimit}\n`);
16+
1217
const AlgoliaID = process.env.ALGOLIA_APPLICATION_ID;
1318
const AlgoliaSecret = process.env.ALGOLIA_INDEXER_KEY;
1419
const AlgoliaIndexName = process.env.ALGOLIA_INDEX;

0 commit comments

Comments
 (0)