How do I call multiple secrets?

I am trying to use the Secrets feature to keep my Discord bot token, mongoLogin and movieDbAPI tokens all secret. however, i find that i cant call const mySecret more than once. I currently have them in a config.json file. Is there any way i can lock that specific file? Any advice is greatly appreciated.

Rather than calling them all mySecret, why don’t you call them discordToken, mongoLogin, and movieDB?

1 Like

thanks. i will try that. alternatively, could i try const { token, movieDb, mongologin } = require process.env ? one of my other bots has the call like that

I don’t think it works like that, but you can try.
I would do something more like:

const token = process.env.TOKEN_NAME, movieDb = process.env.MOVIE, mongologin = process.env.MONGO;
1 Like

thanks. ill try that.

Put your discord token/mongoLogin and movieDbAPI inside the Secrets and call them later with const for JS.

const discordBotToken = process.env.DISCORD_BOT_TOKEN;
const mongoLogin = process.env.MONGO_LOGIN;
const movieDbApiToken = process.env.MOVIE_DB_API_TOKEN;

Or you can use import os and print in python

import os
print(os.getenv("MY_SECRET"))
1 Like

it’s all listed here too (where I got the information)
https://docs.replit.com/programming-ide/workspace-features/secrets

1 Like

thank you for all your suggestions. I tried it as const { token, mongologin, movieDbAPI } = process.env; it is working. I will keep all your suggestions in mind for next time.

2 Likes

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.