首页 > 解决方案 > GCP:使用 x-google-backend 参数配置云 ESPv2 端点

问题描述

我正在使用带有云运行后端服务的 gcp 云端点。我的问题是后端配置了 15 秒的默认超时。这就是为什么我想设置openAPI“x-google-backend”截止时间参数来增加端点的超时时间:(https://cloud.google.com/endpoints/docs/openapi/openapi-extensions

目前我正在为我的端点使用以下 grpc 服务配置。

https://cloud.google.com/endpoints/docs/grpc/grpc-service-config

这种配置不支持 openAPI 扩展。现在我正在寻找一种将 grpc 配置与 openAPI 结合起来的方法。我读过可以为一个端点发布多个配置文件。

标签: google-cloud-platformopenapigoogle-cloud-rungoogle-cloud-endpoints-v2

解决方案


好的,这种配置效果很好。

type: google.api.Service
config_version: 3
name: ${cloud_run_hostname_endpoint}
title: ${endpoint_title}
apis:
  - name: my_endpoint_name
usage:
  rules:
  # No APIs can be called without an API Key
  - selector: "*"
    allow_unregistered_calls: false
backend:
  rules:
    - selector: "*"
      address: grpcs://${cloud_run_hostname_backend}
      deadline: 300.0

接受期限参数。


推荐阅读