Elastic Beanstalk environment variables for Docker host

后端 未结 5 670
春和景丽
春和景丽 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:28

    I haven't tested this on all versions of Elasticbeanstalk. But on at least 64bit Amazon Linux 2015.03 v2.0.1 running Multi-container Docker 1.6.2 (Generic) there's a nicer way to get the envars from your config. There's a ruby script on the instance already that provides a proper json representation of the envars { "SOME_ENV_VAT" : "VALUE" }

    # returns literal null from jq
    sudo /opt/elasticbeanstalk/bin/get-config environment | jq -r '.MY_ENVVAR'
    
    # returns empty string. Usefull for bash -z
    sudo /opt/elasticbeanstalk/bin/get-config environment | jq -r '.MY_ENVVAR // empty'
    

提交回复
热议问题