Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
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