# HG changeset patch # User James Callahan # Date 1323739801 -39600 # Node ID 0e07810550c8c06a2ecc3fe4c90e541b1f606116 # Parent b6d2ac38612067ac877da7987452533b8b6f2ee6 mod_storage_mongodb: Use _global as host when none provided diff -r b6d2ac386120 -r 0e07810550c8 mod_storage_mongodb/mod_storage_mongodb.lua --- a/mod_storage_mongodb/mod_storage_mongodb.lua Mon Dec 12 21:51:29 2011 +1100 +++ b/mod_storage_mongodb/mod_storage_mongodb.lua Tue Dec 13 12:30:01 2011 +1100 @@ -14,7 +14,8 @@ keyval_store.__index = keyval_store; function keyval_store:get(username) - local host, store = module.host, self.store; + local host = module.host or "_global"; + local store = self.store; local namespace = params.dbname .. "." .. host; local v = { _id = { store = store ; username = username } }; @@ -28,8 +29,8 @@ end function keyval_store:set(username, data) - local host, store = module.host, self.store; - if not host then return nil , "mongodb cannot currently be used for host-less data" end; + local host = module.host or "_global"; + local store = self.store; local namespace = params.dbname .. "." .. host; local v = { _id = { store = store ; username = username } };