Community Participant

JS to determine test/beta/prod environment

I'm starting to dig into building custom JS. Is there a recommended method to determine whether the script is being run from the test, beta, or production environments? Would just checking the page URL be sufficient?

Labels (2)
0 Kudos
2 Replies
New Member

Would you specify your question further? Meanwhile, the access tokens to the production environment API and to the test/beta are different, which prevents one from accidentally running the unwanted environment.

0 Kudos
Community Coach
Community Coach

Hi @rtoon,

For Instructure cloud hosted Canvas instances, I think you can check the "ENV.RAILS_ENVIRONMENT" variable as a more universal way of determining the environment than just looking at the URL.  Looking at the URL would be find if you're developing for a single canvas instance where you know for sure what the URL for each environment is, but if this is for wider audience, the URLS could vary and there could even be more than one URL for each environment.