Is there a way to tell programmatically at run-time whether a Google App Engine application is running locally vs. hosted? I'm looking for a way to call some custom stub code when running in a local development environment and make different calls when running hosted.
You can use com.google.appengine.api.utils.SystemProperty
in AppEngine 1.3.
import com.google.appengine.api.utils.SystemProperty;
import static com.google.appengine.api.utils.SystemProperty.environment;
import static com.google.appengine.api.utils.SystemProperty.Environment.Value.Development;
import static com.google.appengine.api.utils.SystemProperty.Environment.Value.Production;
SystemProperty.Environment.Value env = environment.value();
if (env == Production) {
//prod only code
...
} else if(env == Development) {
//dev only code
...
}
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With