Commit 37fe664d2601e2ad77a291ea4818e525e5e4b765

Authored by Nick Recobra
2 parents 864745a4 e33968f9
Exists in master and in 1 other branch production

Merge pull request #42 from wegowise/mongolab

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
... ...