Permalink
Browse files

Keep API keys out of source control.

  • Loading branch information...
1 parent ec764d8 commit 4b7c3d9602760e5846d35755e6aee7f1c527e931 @spraints committed Feb 18, 2011
Showing with 15 additions and 2 deletions.
  1. +1 −0 .gitignore
  2. +14 −2 config/initializers/omnisocial.rb
View
@@ -3,3 +3,4 @@ db/*.sqlite3
log/*.log
tmp/
.*.swp
+.omnisocial.yml
@@ -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

0 comments on commit 4b7c3d9

Please sign in to comment.