如何检查服务器是否在App Engine上运行 [英] How can I check if the server is running on app engine
本文介绍了如何检查服务器是否在App Engine上运行的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我需要检查服务器是否在应用引擎上运行。
I need to check if the server is running on app engine.
类似这样的事情:
if (canRunAppEngine) {
runAppEngine(app.handleRequest);
} else {
app.start();
}
推荐答案
您可以指定环境变量和然后检查您的Dart代码是否已设置
You can specify environment variables and then check in your Dart code whether it is set
> app.yaml
env_variables:
IS_APPENGINE: 'true'
在Dart中
if(Platform.environment['IS_APPENGINE'] == 'true') {
...
}
这篇关于如何检查服务器是否在App Engine上运行的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文