【发布时间】:2021-10-21 09:51:36
【问题描述】:
我们使用无服务器将 graphql 处理程序函数部署为 Azure 函数并通过 APIM 访问它。
我们需要使用自己的自定义域(通过 CNAME 指向 Azure APIM 域),可以通过 Azure 门户手动设置,并上传证书+指定证书密码。
但是,如果我们执行“sls deploy”,则自定义域设置将被删除,因此我们需要以某种方式保留它或通过 serverless.yml 指定它,但我找不到有关如何执行此操作的任何信息。
当前 serverless.yml 配置:
service: my-service-${env:STAGE, 'develop'}
configValidationMode: off
provider:
name: azure
runtime: nodejs12
region: north-europe
resourceGroup: My-Service-Group
subscriptionId: MySubscriptionId
stage: ${env:STAGE, 'develop'}
apim: true
plugins:
- serverless-azure-functions
functions:
graphql:
handler: lib/azure.handler
events:
- http: true
methods:
- GET
- POST
authLevel: anonymous # can also be `function` or `admin`
route: graphql
- http: true
direction: out
name: "$return"
route: graphql
我们将不胜感激。
【问题讨论】:
标签: azure azure-functions serverless azure-api-management