Is there a way to determine if code is running in a local, test environment or in App Engine?

I am developing a Google App Engine Go application and testing it locally. I have variables for the test environment and some variables for the Live App Engine environment. I am wondering if there is some way to determine inside the code in which environment the code is running, and use the correct version of the variable without commenting and uncommenting the code all the time.

+6
source share
1 answer

Have you read the documents at runtime?

He points to this https://developers.google.com/appengine/docs/go/reference document, which contains a list of functions that provide you with information about the runtime.

In particular

func IsDevAppServer() bool 
+7
source

Source: https://habr.com/ru/post/969667/


All Articles