The staticEnvironment static class is available to find out the current deployId. Using the current deployment, you can query the Diagnostics Management API to find out whether the deployment type is 0 or 1. I believe that β0β is production, and β1β is stage.
Hope this helps.
source share