From fb683837251d998e9cee57d875d67a037a70dde5 Mon Sep 17 00:00:00 2001 From: Victor Zheng <36215359+smilesthesad@users.noreply.github.com> Date: Wed, 7 Dec 2022 23:31:26 -0500 Subject: [PATCH] move crunchbase api key to env (#415) --- config/vars.template.json | 3 +-- docs/SETUP.md | 6 ++++-- src/utils/companyInfo.ts | 3 +-- 3 files changed, 6 insertions(+), 6 deletions(-) diff --git a/config/vars.template.json b/config/vars.template.json index 4243bb21..b5424ad4 100644 --- a/config/vars.template.json +++ b/config/vars.template.json @@ -7,6 +7,5 @@ "OFFICE_STATUS_CHANNEL_ID": "CHANNEL_ID", "RESUME_CHANNEL_ID": "CHANNEL_ID", "IRC_USER_ID": "USER_ID", - "MOD_USER_ID_FOR_BAN_APPEAL": "USER_ID", - "CRUNCHBASE_API_KEY": "CRUNCHBASE_KEY" + "MOD_USER_ID_FOR_BAN_APPEAL": "USER_ID" } diff --git a/docs/SETUP.md b/docs/SETUP.md index 69f648c1..9b020ec6 100644 --- a/docs/SETUP.md +++ b/docs/SETUP.md @@ -33,16 +33,18 @@ Then, add your bot to the Discord testing server. - `OFFICE_STATUS_CHANNEL_ID`: the ID of the office hours channel. - `IRC_USER_ID`: the user ID of the irc-bridge bot. - `MOD_USER_ID_FOR_BAN_APPEAL`: the user ID of the mod tagged in the appeal messages for bans. -- `CRUNCHBASE_API_KEY`: API key if you wish to use the upcoming enroll company feature. (Create an account here)[https://www.crunchbase.com/home]. NOTE: feature is still under construction. Note that this file will not be pushed to the remote. 6. Make an `.env` file in the root folder of the project, and put your Discord bot's token, which can be found in the Discord Developer Portal. The format of the `.env` file should be as follows. ``` DISCORD_TOKEN= +CRUNCHBASE_API_KEY= ``` -DO NOT REVEAL THIS TOKEN; ANYONE WITH THIS TOKEN CAN CONTROL YOUR BOT. +DO NOT REVEAL THE DISCORD_TOKEN; ANYONE WITH THIS TOKEN CAN CONTROL YOUR BOT. + +For the `CRUNCHBASE_API_KEY`: This is the API key if you wish to use the upcoming enroll company feature. (Create an account here)[https://www.crunchbase.com/home]. NOTE: feature is still under construction. Note that this file will also not be pushed to the remote. diff --git a/src/utils/companyInfo.ts b/src/utils/companyInfo.ts index 426a1907..223cc00c 100644 --- a/src/utils/companyInfo.ts +++ b/src/utils/companyInfo.ts @@ -1,4 +1,3 @@ -import { vars } from '../config'; import { isValidUrl } from './validateUrl'; import fetch from 'node-fetch'; @@ -26,7 +25,7 @@ const getCompanyInfo = async (companyCrunchbaseLink: string) => { } const response = await fetch( - `${CRUNCHBASE_ORGANIZATION_API_URL}${companyName}?user_key=${vars.CRUNCHBASE_API_KEY}&field_ids=categories,short_description`, + `${CRUNCHBASE_ORGANIZATION_API_URL}${companyName}?user_key=${process.env.CRUNCHBASE_API_KEY}&field_ids=categories,short_description`, ); const data = await response.json(); if (data.error) {