Production/Staging in Editor always reflected in Production/Public app

Hi guys,

I noticed something very unusual today.

If you switch an app in Editor mode to the Staging resource, this also switches the live published/public app to use the Staging resource!! I tested this a couple of times using data I knew to be on Production but not Staging and it appears to be the case.

This somewhat defeats the point of having a Staging resource for development. If I switch to Staging while developing, my users are also then editing data in the live copy of the app on Staging, not Production?!

In the meantime, we will have to develop changes against Staging in entirely separate copies of Apps and then shift changes by way of app link not release workflow…



1 Like

Hi Jack!

Switching from production to staging resources creates a flag in your cache which signifies that you’re now using Retool in staging mode (toggling back to production would then remove it). This flag is only stored locally, and wouldn’t be able to globally change an apps production datasource. Clearing your cache, or having another user access the instance should verify that this is functioning correctly.

1 Like

I'm adding to this thread as I think this behavior is somewhat odd.

Here's our story in case any of you are interested in it:
We have tools that access different environments (production and staging) and will require the non-editor users to be able to toggle between the 2 environments. With the existing Retool functionalities, we have been asking our users to add in _environment=<env> in the URL params but it is not something very intuitive.

Instead of editors adding in a toggle that does the switch, can Retool expose that toggle to users as well?

Hi @ilsemaj! For now, since the environment can be changed from the url params it should be possible to create a toggle in the app itself that switches environments if you'd like to expose that functionality to all users of the app.

I threw together an example of a module that changes the _environment param (and creates one if it doesn't exist). Haven't done a lot of testing on it but it might be a good start!

Thanks @Kabirdas! It's on our to-do list but it's low impact so your work definitely will accelerate everything :slight_smile: