changeset 507:46f578da4ff0

mod_storage_mongodb: assert the configuration options
author James Callahan <james@chatid.com>
date Wed, 14 Dec 2011 12:47:49 +1100
parents 0e07810550c8
children 9831506dcfd6
files mod_storage_mongodb/mod_storage_mongodb.lua
diffstat 1 files changed, 3 insertions(+), 2 deletions(-) [+]
line wrap: on
line diff
--- a/mod_storage_mongodb/mod_storage_mongodb.lua	Tue Dec 13 12:30:01 2011 +1100
+++ b/mod_storage_mongodb/mod_storage_mongodb.lua	Wed Dec 14 12:47:49 2011 +1100
@@ -1,8 +1,7 @@
 local next = next;
 local setmetatable = setmetatable;
 
-local log = require "util.logger".init("mongodb");
-local params = module:get_option("mongodb");
+local params = assert ( module:get_option("mongodb") , "mongodb configuration not found" );
 
 local mongo = require "mongo";
 
@@ -17,6 +16,7 @@
 	local host = module.host or "_global";
 	local store = self.store;
 
+	-- The database name can't have a period in it (hence it can't be a host/ip)
 	local namespace = params.dbname .. "." .. host;
 	local v = { _id = { store = store ; username = username } };
 
@@ -32,6 +32,7 @@
 	local host = module.host or "_global";
 	local store = self.store;
 
+	-- The database name can't have a period in it (hence it can't be a host/ip)
 	local namespace = params.dbname .. "." .. host;
 	local v = { _id = { store = store ; username = username } };