gpt4 book ai didi

python-3.x - 无服务器.yml : Reference existing environment variable in another

转载 作者:行者123 更新时间:2023-12-04 12:34:37 24 4
gpt4 key购买 nike

我有一个 serverless.yml看起来像这样

service: my-service

provider:
name: aws
runtime: python3.7
versionFunctions: false

environment:
ACCOUNT_ID: "${file(./serverless.env.yml):${self:provider.stage}.account_id}"
ANOTHER_VARIABLE: "some text ${ACCOUNT_ID} some other text"
这里,我想引用现有环境 ACCOUNT_IDANOTHER_VARIABLE . ${ACCOUNT_ID}不起作用。我还尝试查看无服务器文档,但找不到与此相关的任何内容。

最佳答案

您可以简单地使用 ${self:provider.environment.ACCOUNT_ID} .

service: my-service

provider:
name: aws
runtime: python3.7
versionFunctions: false

environment:
ACCOUNT_ID: "${file(./serverless.env.yml):${self:provider.stage}.account_id}"
ANOTHER_VARIABLE: "some text ${self:provider.environment.ACCOUNT_ID} some other text"

关于python-3.x - 无服务器.yml : Reference existing environment variable in another,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/62771363/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com