Staging or Production Instance?

后端 未结 6 393
广开言路
广开言路 2020-11-29 18:45

Is there anywhere in the service runtime that would tell me if I\'m currently running on \'Staging\' or \'Production\'? Manually modifying the config to and from production

6条回答
  •  陌清茗
    陌清茗 (楼主)
    2020-11-29 19:19

    An easy way to solve this problem is setting at your instances an key to identify which environment it is running.

    1) Set at your production slot: Set it Settings >> Application settings >> App settings And create a key named SLOT_NAME and value "production". IMPORTANT: check Slot setting.

    2) Set at your staging slot: Set it Settings >> Application settings >> App settings And create a key named SLOT_NAME and value "staging". IMPORTANT: check Slot setting.

    Access from your application the variable and identify which environment the application is running. In Java you can access:

    String slotName = System.getenv("APPSETTING_SLOT_NAME");
    

提交回复
热议问题