Commit e33968f9dbe88365bd01b3e1c027bd02a2ab2aaf

Authored by Jonathan Dance
Committed by Gabriel Horner
1 parent 864745a4
Exists in master and in 1 other branch production

add support for Mongolab heroku addon

Showing 1 changed file with 3 additions and 3 deletions   Show diff stats
config/initializers/mongo.rb
1   -if ENV['MONGOHQ_URL']
2   - settings = URI.parse(ENV['MONGOHQ_URL'] || 'mongodb://localhost/sushi')
  1 +if mongo = ENV['MONGOHQ_URL'] || ENV['MONGOLAB_URI']
  2 + settings = URI.parse(mongo)
3 3 database_name = settings.path.gsub(/^\//, '')
4 4  
5 5 Mongoid.configure do |config|
6 6 config.master = Mongo::Connection.new(settings.host, settings.port).db(database_name)
7 7 config.master.authenticate(settings.user, settings.password) if settings.user
8 8 end
9   -end
10 9 \ No newline at end of file
  10 +end
... ...