有没有办法检查云 运行 服务上的 process.env 变量?

Is there a way to inspect the process.env variables on a cloud run service?

部署后,有没有办法检查 运行ning 云 运行 服务上的 process.env 变量?

我认为它们会出现在以下页面中:

https://console.cloud.google.com/run/detail

有没有办法让它们在这里可用?或者以其他方式检查它?

PS: 这是一个 Docker 容器。

我的 Docker 文件中有以下 ENV。我知道他们在场,因为一切都在按预期进行。但是我在服务详情中看不到它们:

Docker文件

ENV NODE_ENV=production
ENV PROJECT_ID=$PROJECT_ID
ENV SERVER_ENV=$SERVER_ENV

我正在使用 cloudbuild.yaml 文件。 ENV 指令存在于我的 Dockerfile 中,并且它们正在传递到我的容器中。也许我应该将 env 添加到我的 cloudbuild.yaml 文件中?因为我在我的 gcloub builds sumbmit 调用中使用 --substitutions 并且它们作为 --build-arg 传递到我的 Docker build 步骤。但是我没有在 cloudbuild.yaml.

中将它们声明为 env

我按照 official documentation 并使用 console.Then 在云 运行 服务上设置了环境变量,我能够在 Google 云控制台上列出它们。

You can set environment variables using the Cloud Console, the gcloud command line, or a YAML file when you create a new service or deploy a new revision:

借助@marian.vladoi的回答。这就是我最终所做的

在我的 cloudbuild.yaml 文件部署步骤中:

我添加了--set-env-vars参数

steps:

    # DEPLOY CONTAINER WITH GCLOUD
  - name: "gcr.io/google.com/cloudsdktool/cloud-sdk"
    entrypoint: gcloud
    args:
      - "beta"
      - "run"
      - "deploy"
      - "SERVICE_NAME"
      - "--image=gcr.io/$PROJECT_ID/SERVICE_NAME:$_TAG_NAME"
      - "--platform=managed"
      - "--region=us-central1"
      - "--min-instances=$_MIN_INSTANCES"
      - "--max-instances=3"
      - "--set-env-vars=PROJECT_ID=$PROJECT_ID,SERVER_ENV=$_SERVER_ENV,NODE_ENV=production"
      - "--port=8080"
      - "--allow-unauthenticated"
    timeout: 180s