Mercurial > prosody-modules
changeset 509:bf2ad6d6c778
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:36:50 +1100 |
parents | 9831506dcfd6 |
children | 928fe4d91333 |
files | mod_storage_mongodb/mod_storage_mongodb.lua |
diffstat | 1 files changed, 5 insertions(+), 1 deletions(-) [+] |
line wrap: on
line diff
--- a/mod_storage_mongodb/mod_storage_mongodb.lua Wed Dec 14 12:56:07 2011 +1100 +++ b/mod_storage_mongodb/mod_storage_mongodb.lua Mon Dec 19 10:36:50 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