Ask coding questions

← Back to all posts
how do i insert an environment variable into my config.json file
coolgamerc10 (0)

i have a config.json file and i dont know how ot insert my environment variable into the json file

EpicGamer007 (1794)

You cannot keep your bot token in a config.json file, you need to make a config.js file then access process.env from there for your bot token or just not use a config.js or config.json for the bot token ad just access it from the js itself.

SixBeeps (5629)

If you're talking about your bot's token, don't put that in the config.json file. Doing so will cause it to be exposed out to the public, and that's no good. Instead, use the Secrets tab located to the left of the editor, create a new secret called 'token', and put it there.