-
Notifications
You must be signed in to change notification settings - Fork 60
Open
Description
Now in AWS is possible to define environment variables directly inside the AWS OpsWorks console.
To do that we have to go to "Apps" section and click on the actions "edit" related to our app.
Then, under "Environment Variables" we can declare all env variables we need.
These variables are passed to Chef inside the JSON and we can refer to them with: deploy[:environment_variables]
To let this recipe works both with deploy[:environment_variables] and variables passed with a custom JSON (like this documentation says) I changed a bit the write_config.rb file.
recipes/write_config.rb now is:
node[:deploy].each do |application, deploy|
environment_variables = deploy[:custom_env].to_h.merge(deploy[:environment_variables].to_h)
custom_env_template do
application application
deploy deploy
env environment_variables
end
end
Where my custom JSON is:
{
"deploy" : {
"app_name" : {
"symlink_before_migrate" : {
"config/application.yml": "config/application.yml"
},
"custom_env" : {
"ENV1" : "foobar",
"ENV2" : "barfoo"
}
}
}
}
@joeyAghion what do you think about this change?
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels