2 years ago
hello, been trying to use railway to deploy a discord.js bot, but i can't seem to get my token working.
GitHub understandably won't let me upload a discord token to my repo, since other people could see it and mess with my bot, so i'm tryna figure out shared variables.
i put my token as a shared variable on my project, shared it to my deployment, and i put "token":"${{shared.token}}" into my config.json, where my token once was.
(my config.json, where i'm trying to access the variable ↓)
{
"token": "${{shared.token}}",
"clientId": "(my bot's ID is here.)"
}
```however, when trying to use `const {token} = require('./config.json')` and deploying it, it says i have an invalid token.
my code is being run on railway, from a GitHub repo.
what exactly am i doing wrong here, and what should i do to get my shared variables?
my project id: d318ba42-07f6-4530-bc4e-7154f0f6d8244 Replies
P.S. i'm stupid.
i named my env file secrets.env instead of just .env.
after properly renaming it, adding token="${{shared.token}}" and using process.env.token worked.
2 years ago
please do not upload a secrets.env file to GitHub
2 years ago
it shouldn't be either, you shouldn't have files that contain sensitive information in your repo