Jag*_*row 6 yaml amazon-web-services aws-api-gateway serverless-framework
我想在为 api 网关使用阶段变量时转义 $ 符号。
当我尝试部署时出现以下错误。
变量 stageVariables.capabilitySecurityUrl 的变量引用语法无效。您只能引用环境变量、选项和文件。您可以查看我们的文档以获取更多信息。
我尝试了以下选项,但不起作用
1) 使用不带引号的 Uri:https://${stageVariables.capabilitySecurityUrl}
2) 使用引号 Uri: "https://${stageVariables.capabilitySecurityUrl}"
3) 从文件访问变量
./stageVariables.json
{
"capabilitySecurityUrl":"https://${stageVariables.capabilitySecurityUrl}"
}
./serverless.yml
${file(./stageVariables.json):capabilitySecurityUrl}
Run Code Online (Sandbox Code Playgroud)
有什么帮助吗?
正如作者所说,自定义variableSyntax对我有用:
# notice the double quotes for yaml to ignore the escape characters!
# Use this for allowing CloudFormation Pseudo-Parameters in your serverless.yml
# e.g. ${stageVariables.my_var}. All other Serverless variables work as usual.
variableSyntax: "\\${((?!stageVariables)[ ~:a-zA-Z0-9._@'\",\\-\\/\\(\\)]+?)}"
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
1194 次 |
| 最近记录: |