Article
· Oct 9, 2017 1m read

Preventing a production from running in the wrong environment

When implementing our Deltanji source control product on Ensemble or HealthShare sites I sometimes encounter places that implement multiple production classes, e.g. one for their DEV environment and another for their LIVE one.

One such site had a concern about the possibility that the wrong production would be started in the wrong environment. Here's the solution I offered.

Implement the OnStart method in your production classes and code it to return an error status if it's not on the correct environment. For example:

ClassMethod OnStart(pTimeStarted As %String) As %Status
{
 If $Piece($system,":",2)'="XXXLIVE" Quit $$$ERROR($$$GeneralError,"Production can only run on XXXLIVE (blocked by code in its OnStart method)")
 Quit $$$OK
}

I hope this may be useful to others.

Discussion (1)2
Log in or sign up to continue