Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How can I check if the server is running on app engine

I need to check if the server is running on app engine.

Something like this:

if (canRunAppEngine) {
    runAppEngine(app.handleRequest);
} else {
    app.start();
}
like image 760
Miguel Fermin Avatar asked Sep 06 '25 01:09

Miguel Fermin


1 Answers

You can specify environment variables and then check in your Dart code whether it is set

https://cloud.google.com/appengine/docs/python/config/appconfig#Python_app_yaml_Defining_environment_variables

app.yaml

env_variables:
  IS_APPENGINE: 'true'

in Dart

if(Platform.environment['IS_APPENGINE'] == 'true') {
  ...
}
like image 179
Günter Zöchbauer Avatar answered Sep 09 '25 16:09

Günter Zöchbauer