Issue
I have two Appsmith servers connected to the same Git repo. The backend_api datasource is different for each server, and I need to know which environment is being used (local or production). I cannot find a way to extract the URL from the datasource and the suggested solution of using different app names is not foolproof. I am considering adding a special backend route to indicate which configuration is being used.
Resolution
The issue is that there are two Appsmith servers using the same git repo, but with different backend_api datasource URLs for development (local) and production environments. The goal is to determine which environment is being used within the Appsmith code itself. While using app names as a workaround is suggested, it isn't 100% reliable since using the same server and datasource can have different environments.
One possible solution is to create a special backend route that returns information on which configuration is currently running, either production or local. This route can be accessed within the Appsmith code to determine the environment.
Another possibility is to add a variable to the docker.env file and access its value from within the Appsmith code. This variable can be set to either local or production depending on the environment. However, this requires manually modifying the server configuration.
Overall, the best solution may depend on the specific use case and server setup.