Skip to content

Commit

Permalink
move crunchbase api key to env (#415)
Browse files Browse the repository at this point in the history
  • Loading branch information
victorzheng02 authored Dec 8, 2022
1 parent 166e0fb commit fb68383
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 6 deletions.
3 changes: 1 addition & 2 deletions config/vars.template.json
Original file line number Diff line number Diff line change
Expand Up @@ -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"
}
6 changes: 4 additions & 2 deletions docs/SETUP.md
Original file line number Diff line number Diff line change
Expand Up @@ -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=<insert token here>
CRUNCHBASE_API_KEY=<insert crunchbase key here>
```

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.

Expand Down
3 changes: 1 addition & 2 deletions src/utils/companyInfo.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
import { vars } from '../config';
import { isValidUrl } from './validateUrl';
import fetch from 'node-fetch';

Expand Down Expand Up @@ -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) {
Expand Down

0 comments on commit fb68383

Please sign in to comment.