Skip to content

Instantly share code, notes, and snippets.

@fujimura
Created May 11, 2012 10:05
Show Gist options
  • Star 2 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save fujimura/2658724 to your computer and use it in GitHub Desktop.
Save fujimura/2658724 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