Mercurial > prosody-modules
changeset 511:928fe4d91333
mod_storage_mongodb: (un)lock globals around require; only auth if we need to
author | James Callahan <james@chatid.com> |
---|---|
date | Mon, 19 Dec 2011 10:40:28 +1100 |
parents | bf2ad6d6c778 (diff) 59e80326f2b3 (current diff) |
children | c819365ac6ab |
files | |
diffstat | 1 files changed, 5 insertions(+), 1 deletions(-) [+] |
line wrap: on
line diff
--- a/mod_storage_mongodb/mod_storage_mongodb.lua Wed Dec 14 18:42:55 2011 +0100 +++ b/mod_storage_mongodb/mod_storage_mongodb.lua Mon Dec 19 10:40:28 2011 +1100 @@ -3,7 +3,9 @@ local params = assert ( module:get_option("mongodb") , "mongodb configuration not found" ); +prosody.unlock_globals(); local mongo = require "mongo"; +prosody.lock_globals(); local conn @@ -48,7 +50,9 @@ if not conn then conn = assert ( mongo.Connection.New ( true ) ); assert ( conn:connect ( params.server ) ); - assert ( conn:auth ( params ) ); + if params.username then + assert ( conn:auth ( params ) ); + end end if not typ then -- default key-value store