76e6620f0bfc2240b45505446f5cba41b9b72817
max
  Thu Mar 6 03:39:36 2014 -0800
Allow special value HTTPHOST for central.domain and wiki.host, so aserver can be reached under multiple names. Might be a good default
value for our example hg.conf? refs #11957

diff --git src/hg/lib/wikiLink.c src/hg/lib/wikiLink.c
index a51f437..fabdd88 100644
--- src/hg/lib/wikiLink.c
+++ src/hg/lib/wikiLink.c
@@ -15,33 +15,38 @@
 {
 return cloneString(cfgOption(CFG_LOGIN_SYSTEM_NAME));
 }
 
 boolean loginSystemEnabled()
 /* Return TRUE if login.systemName  parameter is defined in hg.conf . */
 {
 #ifdef USE_SSL
 return (cfgOption(CFG_LOGIN_SYSTEM_NAME) != NULL);
 #else
 return FALSE;
 #endif
 }
 
 char *wikiLinkHost()
-/* Return the wiki host specified in hg.conf, or NULL.  Allocd here. */
-{
-return cloneString(cfgOption(CFG_WIKI_HOST));
+/* Return the wiki host specified in hg.conf, or NULL.  Allocd here. 
+ * Returns hostname from http request if hg.conf entry is HTTPHOSTNAME.
+ * */
+{
+char *wikiHost = cfgOption(CFG_WIKI_HOST);
+if ((wikiHost!=NULL) && sameString(wikiHost, "HTTPHOST"))
+    wikiHost = hHttpHost();
+return cloneString(wikiHost);
 }
 
 boolean wikiLinkEnabled()
 /* Return TRUE if all wiki.* parameters are defined in hg.conf . */
 {
 return ((cfgOption(CFG_WIKI_HOST) != NULL) &&
 	(cfgOption(CFG_WIKI_USER_NAME_COOKIE) != NULL) &&
 	(cfgOption(CFG_WIKI_LOGGED_IN_COOKIE) != NULL));
 }
 
 static char *wikiLinkUserNameCookie()
 /* Return the cookie name specified in hg.conf as the wiki user name cookie. */
 {
 return cfgOption(CFG_WIKI_USER_NAME_COOKIE);
 }