I would recommend that you add a DTAP (Dev, Test, Acceptance, Production) constant to your project. You can then simply maintain your constant on each environment. Set it once in each environment and you're done.
In your master layout, you could add a CustomString (populated via microflow) that adds a tag to non-production environments. If you put this on the master layout, it will only be executed once when you open the app, so it shouldn't be a concern for performance.