如何在AWS codestar中设置环境属性?

问题描述 投票:1回答:1

我在AWS codestar中创建了一个spring项目。我想将环境属性传递给我的应用程序(例如DATA_SOURCE_URL)。我可以在弹性beanstalk中的“配置” - >“软件”“修改”并添加属性。但是,每当触发新部署时,此配置都会重置。

我想知道在使用AWS codestar时设置环境属性的方式是什么。

amazon-cloudformation aws-code-deploy aws-codestar
1个回答
1
投票

因为它可以帮助搜索解决方案的其他人,我最终通过使用Beanstalk中的Saved Configuration函数并通过cloud formation template.yml调用它来工作:EBConfigurationTemplate(来自codestar的autogenerated template.yml)


  EBConfigurationTemplate:
    [...]
    SourceConfiguration:
      ApplicationName: !Ref 'EBApplication'
      TemplateName: "Saved Configuration Name"

之后我的django应用程序能够读取os.environ ['ENV_VAR_NAME']以及能够连接到RDS(由beanstalk非托管)进行迁移的django.config作为container_command

© www.soinside.com 2019 - 2024. All rights reserved.