Last Updated: February 25, 2016
·
1.043K
· mrclmrvn

Rails configuration yaml files served via chef

["s3", "urbanairship", "newrelic"].each do |yaml|
  unless node[yaml.to_sym].empty?
    template "#{node[:deploy][application][:deploy_to]}/shared/config/#{yaml}.yml" do
      # create template under recipename/templates/default
      # i.e. urbanairship.yml.erb 
      source "#{yaml}.yml.erb"
      mode "0660"
      owner deploy[:user]
      group deploy[:group]
      variables(:environment => deploy[:rails_env], :config => node[yaml.to_sym])
      only_if do
        File.exists?("#{node[:deploy][application][:deploy_to]}/shared/config")
      end
    end
  end
end