Changeset

506:0e07810550c8

mod_storage_mongodb: Use _global as host when none provided
author James Callahan <james@chatid.com>
date Tue, 13 Dec 2011 12:30:01 +1100
parents 505:b6d2ac386120
children 507:46f578da4ff0
files mod_storage_mongodb/mod_storage_mongodb.lua
diffstat 1 files changed, 4 insertions(+), 3 deletions(-) [+]
line wrap: on
line diff
--- 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 } };