https://discord.gg/botpress logo
Environment configuration in one bot
# 🤝help
f
How to configure environment variables so that switching the bot from dev to production wouldn’t require major changes. Or the only way to do this is create two different chatbot for the dev and prod?
p
The Configuration variables can store secrets like: API Tokens Private IP Addresses Database usernames and passwords They however cannot affect your bot itself so I don't think they would work in your use case.
f
Thanks for answering! I just want to confirm: I understand that environment variables can store values like API URLs. If I create an environment variable (e.g., API_URL), and in my bot's Custom Code cards I access it with process.env.API_URL. Then, when switching between development and production, I only need to update the environment variable value (no code or flow changes required). Is this the recommended way to handle switching between dev and prod environments in one bot? Or is it still better to create two separate bots — one for dev, one for prod — in case we need different workflows in future?
p
There is no recommended approach on our side. It depends on wether you have two api keys for dev and prod. Although you will most likely end up having two bots, what varies is whether they have the same configuration variables.
3 Views