jschat 0.2.0 → 0.2.1
Sign up to get free protection for your applications and to get access to all the features.
- data/lib/jschat/server_options.rb +3 -1
- data/lib/jschat/storage/mongo.rb +5 -0
- metadata +2 -2
@@ -16,7 +16,9 @@ ServerConfigDefaults = {
|
|
16
16
|
'tmp_files' => File.join(Dir::tmpdir, 'jschat'),
|
17
17
|
'db_name' => 'jschat',
|
18
18
|
'db_host' => 'localhost',
|
19
|
-
'db_port' => 27017
|
19
|
+
'db_port' => 27017,
|
20
|
+
#'db_user' => '',
|
21
|
+
#'db_password' => '',
|
20
22
|
# Register your instance of JsChat here: http://twitter.com/apps/create
|
21
23
|
# 'twitter' => { 'key' => '', 'secret' => '' }
|
22
24
|
}
|
data/lib/jschat/storage/mongo.rb
CHANGED
@@ -7,6 +7,11 @@ module JsChat::Storage
|
|
7
7
|
module MongoDriver
|
8
8
|
def self.connect!
|
9
9
|
@db = Mongo::Connection.new(ServerConfig['db_host'], ServerConfig['db_port']).db(ServerConfig['db_name'])
|
10
|
+
if ServerConfig['db_username'] and ServerConfig['db_password']
|
11
|
+
unless @db.authenticate(ServerConfig['db_username'], ServerConfig['db_password'])
|
12
|
+
raise 'Bad Mongo username or password'
|
13
|
+
end
|
14
|
+
end
|
10
15
|
end
|
11
16
|
|
12
17
|
def self.log(message, room)
|