Ask coding questions

← Back to all posts
Any workaround to using secrets in a json file?
QuackMeansQuack

The bot I'm using requires the token to be in a json file, but I want to use a secret for it. Is there any workaround?

Answered by SixBeeps [earned 5 cycles]
View Answer
Voters
QuackMeansQuack
Comments
hotnewtop
SixBeeps

Go to this line right here

And replace the login parameter with process.env.token.

QuackMeansQuack
SixBeeps

@QuackMeansQuack Swap lines 6 and 7 so that Discord is defined first.

QuackMeansQuack

@SixBeeps It now works perfectly, thanks alot. One of my bots was logged into and nuked my server, so this is a great help.

SixBeeps

@QuackMeansQuack Ohhh yeah definitely don't want that happening. Glad I could help again. Mind marking my comment as the answer?

QuackMeansQuack

@SixBeeps How do I do that?

SixBeeps

@QuackMeansQuack Looks like you've figured it out 👍