jschat 0.2.4 → 0.2.5

Sign up to get free protection for your applications and to get access to all the features.
Files changed (2) hide show
  1. data/lib/jschat/storage/mongo.rb +6 -1
  2. metadata +2 -2
@@ -8,9 +8,13 @@ module JsChat::Storage
8
8
  def self.connect!
9
9
  @db = Mongo::Connection.new(ServerConfig['db_host'], ServerConfig['db_port']).db(ServerConfig['db_name'])
10
10
  if ServerConfig['db_username'] and ServerConfig['db_password']
11
- unless @db.add_auth(ServerConfig['db_name'], ServerConfig['db_username'], ServerConfig['db_password'])
11
+ if @db.authenticate(ServerConfig['db_username'], ServerConfig['db_password'])
12
+ true
13
+ else
12
14
  raise 'Bad Mongo username or password'
13
15
  end
16
+ else
17
+ true
14
18
  end
15
19
  end
16
20
 
@@ -43,6 +47,7 @@ module JsChat::Storage
43
47
  return unless Object.const_defined?(:Mongo)
44
48
  connect!
45
49
  rescue
50
+ p $!
46
51
  puts 'Failed to connect to mongo'
47
52
  false
48
53
  end
metadata CHANGED
@@ -5,8 +5,8 @@ version: !ruby/object:Gem::Version
5
5
  segments:
6
6
  - 0
7
7
  - 2
8
- - 4
9
- version: 0.2.4
8
+ - 5
9
+ version: 0.2.5
10
10
  platform: ruby
11
11
  authors:
12
12
  - Alex R. Young