Browse files

add a recipe for placing an api-keys.yml under config/ on app instances

  • Loading branch information...
1 parent 6dca853 commit 3d0b1be2a583e107a0c86d735c81b6a2a3ae020a @acco acco committed Sep 7, 2012
@@ -0,0 +1,20 @@
+Don't want to check API keys into version control? No problem!
+This Chef recipe will write api-keys.yml to your Rails app's config/ directory on Engine Yard Cloud.
+# Instructions:
+1. Populate the templates/default/api-keys.yml.erb with your production-ready API keys.
+2. Have your Rails app check locally at `config/api-keys.yml` for all API keys that it needs.
+3. Be sure to uncomment `require_recipe "api-keys-yml"` from `cookbooks/main/default/recipes.rb` per usual.
+4. That's it! Upload (`ey recipes upload -e [env]`) and apply (`ey recipes apply -e [env]`)
+If you need a config/api-keys.yml locally for test/dev, create the file as needed.
+# Tips:
+Obviously you'd want to avoid checking these cookbooks or a local api-keys.yml into version control.
+Because you won't be checking config/api-keys.yml into version control, new developers who clone the repository might have trouble running locally without that file in place. We recommend making a file called config/api-keys.yml.example that has fake credentials that are used in your testing suite. That way when the repo is cloned, a developer simply needs to run `cp api-keys.yml.example api-keys.yml` and they're good to go.
@@ -0,0 +1,14 @@
+if ['app_master', 'app'].include?(node[:instance_role])
+ template "/data/#{app}/shared/config/api-keys.yml"do
+ source 'api-keys.yml.erb'
+ owner node[:owner_name]
+ group node[:owner_name]
+ mode 0655
+ backup 0
+ # Pass a hash of variables to the method below and they will be available as local variables in the template.
+ # For API keys this is usually completely unnecessary
+ # variables()
+ end
@@ -0,0 +1 @@
+## Put your API tokens here!
@@ -49,6 +49,9 @@
#uncomment to run the redis recipe
#require_recipe "redis"
+#uncomment to run the api-keys-yml recipe
+require_recipe "api-keys-yml"
#require_recipe "logrotate"
#uncomment to use the solr recipe

0 comments on commit 3d0b1be

Please sign in to comment.