# File lib/openshift/data_store.rb, line 6 def self.db(read_preference=:secondary, session_name='default') config = Mongoid::Config.sessions[session_name] hosts = config['hosts'] ssl = config['options']['ssl'] if hosts.length > 1 con = MongoReplicaSetClient.new(hosts, :read => read_preference, :ssl => ssl) else host_port = hosts[0].split(':') con = MongoClient.new(host_port[0], host_port[1].to_i, :ssl => ssl) end db = con.db(config['database']) db.authenticate(config['username'], config['password']) db end
Generated with the Darkfish Rdoc Generator 2.