Skip to content

Instantly share code, notes, and snippets.

@Epictetus
Forked from fujimura/README.md
Created May 11, 2012 11:40
Show Gist options
  • Save Epictetus/2659157 to your computer and use it in GitHub Desktop.
Save Epictetus/2659157 to your computer and use it in GitHub Desktop.
heroku_config.rake

ローカルのomniauth.ymlにheroku用の設定を書いておいて、

$ rake heroku_config:upload

すればherokuに設定がコピーされます。

namespace :heroku_config do
desc "upload heroku settings"
task :upload => :environment do
%w(omniauth s3 authorized_ids).each do |config_name|
c = File.open("config/#{config_name}.yml", &:read)
`heroku config:add #{config_name.upcase}="#{c}"`
end
end
end
Rails.application.config.middleware.use OmniAuth::Builder do
config = if Rails.env.production?
YAML.load(ENV['OMNIAUTH'])
else
YAML.load_file(Rails.root.join('config/omniauth.yml'))
end
key, secret = config[Rails.env].values_at 'facebook_key', 'facebook_secret'
provider :facebook, key, secret, :scope => :email
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment