I work with an application that can be heavily customized. In many cases for a Greenfield development, the developers and architects will decide to put in place an API that returns what environment you are currently in - usually by introspection looking at the database name but for the sake of this discussion let's avoid any pros or cons related to a specific implementation. Your results might be "Prod" which has special significance, "Test 1" which we then know has special capabilities to interface with other external systems, and "Dev 1" which is relatively not-special.

What I am wondering is if this is a good practice, a judgement call, or a bad practice.

The most obvious pro to me is that it can help automate certain nonproduction refresh tasks without deployment risk. The drawback is that we may frequently find ourselves in a place where testing is not touching code paths that will be taken in prod.

  • 1
    Could you give an example of code paths not taken? and how does a version API end-point cause this? Sep 16, 2019 at 14:56

1 Answer 1


If a developer, tester or architect has a need to see the difference between an environment then adding something like this seems fine. Don't add it because you can, but only because you really need it.

Personally I would make sure the URL shows which environment it is.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.