Elastic Beanstalk environment variables for Docker host

后端 未结 5 673
春和景丽
春和景丽 2021-02-08 04:51

I have an EB env with Docker web app (rails) properly deployed. I set several EB env variables and they are properly visible in the container. Now - I\'d like these EB env varia

5条回答
  •  既然无缘
    2021-02-08 05:44

    King of the one liners.

    eval $(sudo ruby -e 'require "json"; container_config = JSON.parse(File.read("/opt/elasticbeanstalk/deploy/configuration/containerconfiguration")); raw_vars = container_config["optionsettings"]["aws:elasticbeanstalk:application:environment"]; envs = ""; raw_vars.each do |raw_var| envs << "export #{raw_var};\n" end; print envs;')
    

    This will automatically export all the variables. You cannot use puts to output environment variables with Ruby.

提交回复
热议问题