Index: /trunk/gsdl/src/recpt/recptconfig.cpp
===================================================================
--- /trunk/gsdl/src/recpt/recptconfig.cpp	(revision 7417)
+++ /trunk/gsdl/src/recpt/recptconfig.cpp	(revision 7418)
@@ -46,4 +46,7 @@
   text_t *httpdomain;
   text_t *httpprefix;
+  text_t *collection;
+  text_tset *actions;
+  text_tset *browsers;
   int    *maxrequests;
 public:
@@ -52,4 +55,7 @@
     httpdomain = NULL;
     httpprefix = NULL;
+    collection = NULL;
+    actions = NULL;
+    browsers = NULL;
     maxrequests = _maxrequests;
   }
@@ -60,24 +66,69 @@
     httpdomain = _httpdomain;
     httpprefix = _httpprefix;
+    collection = NULL;
+    actions = NULL;
+    browsers = NULL;
     maxrequests = NULL;
   }
 
+  __site_configuration (text_t *_gsdlhome, text_t *_httpdomain,
+			text_t *_httpprefix, text_t *_collection) {
+    gsdlhome    = _gsdlhome;
+    httpdomain = _httpdomain;
+    httpprefix = _httpprefix;
+    collection = _collection;
+    actions = NULL;
+    browsers = NULL;
+    maxrequests = NULL;
+  }
+
+  __site_configuration (text_t *_httpprefix, text_tset *_actions, text_tset *_browsers) {
+    gsdlhome    = NULL;
+    httpdomain = NULL;
+    httpprefix = _httpprefix;
+    collection = NULL;
+    actions = _actions;
+    browsers = _browsers;
+    maxrequests = NULL;
+  }
+
   inline void configure (const text_t &key, const text_tarray &cfgline) {
-    if (key == "gsdlhome") {
+    if (gsdlhome != NULL && key == "gsdlhome") {
       *gsdlhome = cfgline[0];
     }
 
-    if (key == "httpprefix" &&
-	httpprefix != NULL) {
+    if (httpprefix != NULL && key == "httpprefix") {
       *httpprefix = cfgline[0];
     }
 
-    if (key == "httpdomain" &&
-	httpdomain != NULL) {
+    if (httpdomain != NULL && key == "httpdomain") {
       *httpdomain = cfgline[0];
     }
 
-    if (key == "maxrequests" &&
-	maxrequests != NULL) {
+    if (collection != NULL && key == "collection") {
+      *collection = cfgline[0];
+    } 
+
+    if (actions != NULL && key == "actions") {
+      actions->clear();
+      text_tarray::const_iterator thisAction = cfgline.begin();
+      text_tarray::const_iterator endAction = cfgline.end();
+      while (thisAction != endAction) {
+	actions->insert(*thisAction);
+	++thisAction;
+      }
+    } 
+
+    if (browsers != NULL && key == "browsers") {
+      browsers->clear();
+      text_tarray::const_iterator thisBrowser = cfgline.begin();
+      text_tarray::const_iterator endBrowser = cfgline.end();
+      while (thisBrowser != endBrowser) {
+	browsers->insert(*thisBrowser);
+	++thisBrowser;
+      }
+    }
+
+    if (maxrequests != NULL && key == "maxrequests") {
       *maxrequests = cfgline[0].getint();
       if ((*maxrequests) < 1) {
@@ -120,9 +171,63 @@
   httpprefix.clear();
 
-  if (gsdlconfigurator.configure("gsdlsite.cfg")) {
+  if (gsdlconfigurator.configure("gsdlsite.cfg") &&
+      !gsdlhome.empty() && !httpdomain.empty() && !httpprefix.empty()) {
     return true;
   }
 
   return false;
+}
+
+// this version grabs gsdlhome, httpdomain, httpprefix, collection, 
+// returns false if it can't find gsdlhome, httpdomain and httpprefix
+bool site_cfg_read (text_t &gsdlhome, text_t &httpdomain, 
+		    text_t &httpprefix, text_t &collection) {
+  // get gsdlhome etc
+  __site_configuration sitecfg(&gsdlhome, &httpdomain, &httpprefix, &collection);
+  configurator gsdlconfigurator(&sitecfg);
+	
+  gsdlhome.clear();
+  httpdomain.clear();
+  httpprefix.clear();
+  collection.clear();
+	
+  if (gsdlconfigurator.configure("gsdlsite.cfg") &&
+      !gsdlhome.empty() && !httpdomain.empty() && !httpprefix.empty()) {
+    return true;
+  }	
+  return false;
+}
+
+void main_cfg_read (const text_t& collection, const text_t &gsdlhome, text_t &httpprefix, text_tset& actions, text_tset& browsers)
+{
+  __site_configuration sitecfg(&httpprefix, &actions, &browsers);
+  configurator gsdlconfigurator(&sitecfg);
+	
+  httpprefix.clear();
+  actions.clear();
+  browsers.clear();
+
+  text_t filename;
+	
+  filename_cat (filename, gsdlhome, "collect", collection, "etc", "main.cfg");
+  if (!file_exists(filename)) {
+    filename_cat (filename, gsdlhome, "etc", "main.cfg");
+    if (!file_exists (filename)) {
+      filename.clear();
+    }
+  }
+	
+  if (!filename.empty()) gsdlconfigurator.configure(filename);
+
+
+  if (!collection.empty()) {
+    filename_cat (filename, gsdlhome, "collect", collection, "etc", "collect.cfg");
+    if (!file_exists (filename)) {
+      filename_cat (filename, gsdlhome, "etc", "collect.cfg");
+      if (!file_exists (filename)) filename.clear();
+    }
+		
+    if (!filename.empty()) gsdlconfigurator.configure(filename);
+  }
 }
 
@@ -140,8 +245,13 @@
   filename = filename_cat (gsdlhome, "etc");
   filename = filename_cat (filename, "main.cfg");
-  if (file_exists (filename)) {
+  if (!collection.empty() && file_exists(filename)) {
     rv = recpt.read_configfile(filename);
-  }
-  
+  } else {
+    filename_cat (filename, gsdlhome, "etc", "main.cfg");
+    if (file_exists (filename)) {
+      rv = recpt.read_configfile(filename);
+    }
+  }
+
   // Look for collect.cfg in GSDLHOME/collect/collection-name/etc directory 
   // (if this is for a particular collection), and then GSDLHOME/etc.
Index: /trunk/gsdl/src/recpt/recptconfig.h
===================================================================
--- /trunk/gsdl/src/recpt/recptconfig.h	(revision 7417)
+++ /trunk/gsdl/src/recpt/recptconfig.h	(revision 7418)
@@ -38,4 +38,8 @@
 bool site_cfg_read (receptionist &recpt, text_t &gsdlhome, int &maxrequests);
 bool site_cfg_read (text_t &gsdlhome, text_t &httpdomain, text_t &httpprefix);
+bool site_cfg_read (text_t &gsdlhome, text_t &httpdomain, text_t &httpprefix, text_t &collection);
+
+// read main.cfg for the actions and httpprefix
+void main_cfg_read (const text_t& collection, const text_t &gsdlhome, text_t &httpprefix, text_tset& actions, text_tset& browsers);
 
 // main_cfg_read reads either collect.cfg or main.cfg and returning 
