How to handle multi environment bot development

Hi all!

We are working with botpress since January on a feature in which we needed to develop a custom select component that loads it’s items from a rest service. I need a way to tell the bot which service endpoint to use depending on the enviromnent (development, testing or production). Since we are running the bot with Rancher 1, I set a environment variable “ENVIRONMENT=development” but I wasn’t able to get it from custom select component using process.env.

What am I doing wrong? Is there other way to deal with multi environment bots with docker?

Thanks in advance!

Take a look at Environment Variables in the docs for usage.

Botpress Pro has a feature which is called Bot Pipeline to handle multi environment bots but I’m not sure if this is what you really need for your issue.

Hi! Thanks for answering!

I tried to use custom Environment Variables I defined in the Dockerfile, but I couldn’t get their values within the bot’ scope…I tried with node.env.MY_VAR and got undefined.

I assume that should work according the docs, but noup… any clue?


I think you need to put it in a separate env file from the Dockefile as the documentation suggests

Botpress supports .env files, so you don’t have to set them everytime you start the app. Just add the file in the same folder as the executable.

This is another issue but it explains how you can set an environment variable in a .env file :