In the Google app engine (GAE), how can my server tell if this is the default version?

On my Google AppEngine (GAE) server, I would like to do something like this:

if (thisIsTheDefaultServer)
{
    // behave normally
}
else
{
    // Accept special test-commands, give extra output, etc.
}

Is there a way for server code to determine if it is the current default version?

Thank!

+5
source share
3 answers

I remember that the Google App Engine team mentions an API to get something from the toolbar. Sorry, I can not find it at the moment. I think it could be in this conversation: http://www.google.com/events/io/2011/sessions/life-in-app-engine-production.html

, , Java. , Python.

Java (http://code.google.com/appengine/docs/java/javadoc/com/google/appengine/api/utils/SystemProperty.html):

 if (SystemProperty.environment.value() == SystemProperty.Environment.Value.Production) {
   // do something that production-only
 }
 String version = SystemProperty.version.get();

Cheers, Jacob

+2

, . spring:

  • : , . version.app.appspot.com, , , , .
  • , . , , : , , .
+5

(Java Python)

CURRENT_VERSION_ID Python SDK , app.yaml, , com.google.appengine.runtime.version Java runtine.

-1

All Articles