From 4b7c3d9602760e5846d35755e6aee7f1c527e931 Mon Sep 17 00:00:00 2001 From: Matt Burke Date: Fri, 18 Feb 2011 14:18:26 -0500 Subject: [PATCH] Keep API keys out of source control. --- .gitignore | 1 + config/initializers/omnisocial.rb | 16 ++++++++++++++-- 2 files changed, 15 insertions(+), 2 deletions(-) diff --git a/.gitignore b/.gitignore index 15d127d..6f1dee5 100644 --- a/.gitignore +++ b/.gitignore @@ -3,3 +3,4 @@ db/*.sqlite3 log/*.log tmp/ .*.swp +.omnisocial.yml diff --git a/config/initializers/omnisocial.rb b/config/initializers/omnisocial.rb index 437cb20..2263503 100644 --- a/config/initializers/omnisocial.rb +++ b/config/initializers/omnisocial.rb @@ -9,11 +9,23 @@ if Rails.env.production? # Configs for production mode go here + config.twitter ENV['TWITTER_APP_KEY'], ENV['TWITTER_APP_SECRET'] elsif Rails.env.development? - # Configs for development mode go here - + begin + keys = YAML::load open(Pickardayune::Application.config.root + '.omnisocial.yml') + keys.each do |provider, keys| + config.send provider, *keys + end + rescue => e + puts "NO OMNISOCIAL CONFIGURATION HAS BEEN DONE!" + puts "Unable to load omnisocial config from .omnisocial.yml. Example:" + puts " twitter: [ 'appkey', 'appsecret' ]" + puts " facebook: [ 'appkey', 'appsecret', { :scope: publish_stream } ]" + puts e + end + end end