AWS OpsWorks Environment variables not working

前端 未结 3 2073
面向向阳花
面向向阳花 2020-12-15 11:14

I am running Ubuntu 14.04 LTS 64 bit Rails Application and I am unable to access my App environment variables.

In OpsWorks App panel, I set my environment variables,

3条回答
  •  情深已故
    2020-12-15 12:04

    AWS OpsWorks console lets you declare environment variables but to let them be available for our Rails app we need to use a Chef cookbook recipe plus some precautions.

    In a nutshell we use the config/secrets.yml file combined with config/application.yml file, Figaro gem and a Chef cookbook recipe. The chef cookbook recipe read the variables defined in OpsWorks console and let them available to Rails app writing the config/application.yml file.

    I have published a detailed guide to explain how exactly do it. Link here.

    These are the core points that I covered:

    1. Use config/secrets.yml file (added from Rails 4.1)
    2. Use Figaro gem to load variables in the environment
    3. Declare environment variables inside AWS OpsWorks Console
    4. Use a custom Chef recipe to create a config/application.yml file that Figaro will use to let variables available

提交回复
热议问题