Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP

Loading…

need port in connection for mongohq.com #1

Open
versus opened this Issue · 0 comments

1 participant

@versus

require 'sinatra/base'
require 'mongoid'

module Sinatra
module MongoidExtension
def self.registered(app)
app.set :mongo_host, ENV['MONGO_HOST'] || 'localhost'
app.set :mongo_db, ENV['MONGO_DB'] || 'changeme'
app.set :mongo_user, ENV['MONGO_USER']
app.set :mongo_password, ENV['MONGO_PASSWORD']
app.set :mongo_port, ENV['MONGO_PORT'] || '27018'

  Mongoid.database = Mongo::Connection.new(app.mongo_host,app.mongo_port).
                                       db(app.mongo_db)
  if app.mongo_user
    Mongoid.database.authenticate(app.mongo_user,
                                  app.mongo_password)
  end
end

end

register MongoidExtension
end

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Something went wrong with that request. Please try again.