Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Keep API keys out of source control.

  • Loading branch information...
commit 4b7c3d9602760e5846d35755e6aee7f1c527e931 1 parent ec764d8
Matt Burke authored
Showing with 15 additions and 2 deletions.
  1. +1 −0  .gitignore
  2. +14 −2 config/initializers/omnisocial.rb
1  .gitignore
View
@@ -3,3 +3,4 @@ db/*.sqlite3
log/*.log
tmp/
.*.swp
+.omnisocial.yml
16 config/initializers/omnisocial.rb
View
@@ -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
Please sign in to comment.
Something went wrong with that request. Please try again.