【发布时间】:2019-08-30 14:56:53
【问题描述】:
我在谷歌应用引擎上使用 react。
如文档中所述:https://cloud.google.com/appengine/docs/standard/nodejs/runtime#environment_variables
我可以访问以下环境变量:
Environment variable Description
GAE_APPLICATION The ID of your App Engine application.
GAE_DEPLOYMENT_ID The ID of the current deployment.
GAE_ENV The App Engine environment. Set to standard.
GAE_INSTANCE The ID of the instance on which your service is currently running.
GAE_MEMORY_MB The amount of memory available to the application process, in MB.
GAE_RUNTIME The runtime specified in your app.yaml file.
GAE_SERVICE The service name specified in your app.yaml file. If no service name is specified, it is set to default.
GAE_VERSION The current version label of your service.
GOOGLE_CLOUD_PROJECT The GCP project ID associated with your application.
NODE_ENV Set to production when your service is deployed.
PORT The port that receives HTTP requests.
当我在谷歌应用引擎上部署我的应用并打印 process.env console.log(process.env) 我只有:
NODE_ENV: "production"
PUBLIC_URL: ""
在文档中明确写了“以下环境变量由运行时设置”,但是没有一个。
怎么了?
【问题讨论】:
-
我猜你使用的是标准环境,对吧?
-
不,我使用的是 flex 环境
-
那么环境变量列表是this one,你引用的是标准环境。不过,您的问题仍然存在。
-
感谢您为我指出正确的文档,但环境变量仍然是我在问题中报告的两个。