Skip to content
This repository has been archived by the owner on Sep 24, 2019. It is now read-only.

Commit

Permalink
Merge branch 'next'; Fix for #93.
Browse files Browse the repository at this point in the history
  • Loading branch information
Anthony Bargnesi committed Dec 18, 2015
2 parents 1f240bb + f6949c0 commit 1d9000c
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 8 deletions.
6 changes: 1 addition & 5 deletions lib/openbel/api/evidence/mongo.rb
Original file line number Diff line number Diff line change
Expand Up @@ -33,11 +33,7 @@ def initialize(options = {})
{:"$**" => Mongo::TEXT },
:background => true
)
@evidence_facets = EvidenceFacets.new(
:host => host,
:port => port,
:database => db
)
@evidence_facets = EvidenceFacets.new(options)
end

def create_evidence(evidence)
Expand Down
15 changes: 12 additions & 3 deletions lib/openbel/api/evidence/mongo_facet.rb
Original file line number Diff line number Diff line change
Expand Up @@ -12,10 +12,19 @@ class EvidenceFacets
include FacetFilter

def initialize(options = {})
host = options.delete(:host)
port = options.delete(:port)
db = options.delete(:database)
host = options[:host]
port = options[:port]
db = options[:database]
@db = MongoClient.new(host, port).db(db)

# Authenticate user if provided.
username = options[:username]
password = options[:password]
if username && password
auth_db = options[:authentication_database] || db
@db.authenticate(username, password, nil, auth_db)
end

@evidence = @db[:evidence]
@evidence_facets = @db[:evidence_facets]
end
Expand Down

0 comments on commit 1d9000c

Please sign in to comment.