Determine Environment from within a Script

  1. In the CloudCode task, you can access this.env to detect the current environment.
  2. On the app, this is possible using the journey API

More detailed discussion here: How do I programmatically check which environment the app is in?

  1. It’s not possible to programmatically access an app’s name, but please submit new ideas on our public roadmap.

Since the app name doesn’t vary across environments though, one option could be to define the app name as a global const in your app code?