diff options
-rw-r--r-- | package-lock.json | 6 | ||||
-rw-r--r-- | package.json | 3 | ||||
-rw-r--r-- | src/hypixelApi.ts | 5 |
3 files changed, 13 insertions, 1 deletions
diff --git a/package-lock.json b/package-lock.json index f2233b8..acc2a15 100644 --- a/package-lock.json +++ b/package-lock.json @@ -86,6 +86,12 @@ "resolved": "https://registry.npmjs.org/destroy/-/destroy-1.0.4.tgz", "integrity": "sha1-l4hXRCxEdJ5CBmE+N5RiBYJqvYA=" }, + "dotenv": { + "version": "8.2.0", + "resolved": "https://registry.npmjs.org/dotenv/-/dotenv-8.2.0.tgz", + "integrity": "sha512-8sJ78ElpbDJBHNeBzUbUVLsqKdccaa/BXF1uPTw3GrvQTBgrQrtObr2mUrE38vzYd8cEv+m/JBfDLioYcfXoaw==", + "dev": true + }, "ee-first": { "version": "1.1.1", "resolved": "https://registry.npmjs.org/ee-first/-/ee-first-1.1.1.tgz", diff --git a/package.json b/package.json index 53da9f9..fa8155a 100644 --- a/package.json +++ b/package.json @@ -28,5 +28,8 @@ "express": "^4.17.1", "node-cache": "^5.1.2", "node-fetch": "^2.6.1" + }, + "devDependencies": { + "dotenv": "^8.2.0" } } diff --git a/src/hypixelApi.ts b/src/hypixelApi.ts index cb8f0e0..2f66343 100644 --- a/src/hypixelApi.ts +++ b/src/hypixelApi.ts @@ -4,7 +4,10 @@ import fetch from 'node-fetch' import { jsonToQuery, shuffle } from './util' import { Agent } from 'https' -require('dotenv').config() + +if (!process.env.hypixel_keys) + // if there's no hypixel keys in env, run dotenv + require('dotenv').config() // We need to create an agent to prevent memory leaks and to only do dns lookups once const httpsAgent = new Agent({ |