Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Is there a way to detect whether the code is run on local, test environment or on App Engine?

I am developing a Google App Engine Go application and testing it locally. I have some variables for test environment and some variables for the live App Engine environment. I am wondering whether there is some way to determine from inside the code what environment the code is run in and use a proper version of the variable without having to comment and uncomment code all the time.

like image 488
ThePiachu Avatar asked May 21 '14 21:05

ThePiachu


1 Answers

Have you read the docs on the runtime environemnt.

It points to this document https://developers.google.com/appengine/docs/go/reference which lists a bunch of functions that give you information about the runtime environemnt.

Specifically

 func IsDevAppServer() bool
like image 74
Tim Hoffman Avatar answered Oct 12 '22 20:10

Tim Hoffman