c85802ccef6bba0d6159c20950a01094e817c56c
angie
  Thu Dec 15 11:15:23 2016 -0800
Add env var UDC_CACHEDIR to override hg.conf udc.cacheDir for command-line use of CGI.  Add -udcCache option to vai.pl using UDC_CACHEDIR.  refs #12216 note-32

diff --git src/hg/lib/hui.c src/hg/lib/hui.c
index b6aebe7..5eb121c 100644
--- src/hg/lib/hui.c
+++ src/hg/lib/hui.c
@@ -379,31 +379,36 @@
 return cfgOptionDefault("downloads.server", "hgdownload.cse.ucsc.edu");
 }
 
 void setUdcTimeout(struct cart *cart)
 /* set the udc cache timeout */
 {
 int timeout = cartUsualInt(cart, "udcTimeout", 300);
 if (udcCacheTimeout() < timeout)
     udcSetCacheTimeout(timeout);
 }
 
 void setUdcCacheDir()
 /* set the path to the udc cache dir */
 {
 if (cfgOptionBooleanDefault("udc.useLocalDiskCache", TRUE))
-    udcSetDefaultDir(cfgOptionDefault("udc.cacheDir", udcDefaultDir()));
+    {
+    char *cacheDir = getenv("UDC_CACHEDIR");
+    if (isEmpty(cacheDir))
+        cacheDir = cfgOptionDefault("udc.cacheDir", udcDefaultDir());
+    udcSetDefaultDir(cacheDir);
+    }
 else
     udcDisableCache();
 }
 
 
 char *wrapWhiteFont(char *s)
 /* Write white font around s */
 {
 static char buf[256];
 safef(buf, sizeof(buf), "<span style='color:#FFFFFF;'>%s</span>", s);
 return buf;
 }
 
 char *hDocumentRoot()
 /* get the path to the DocumentRoot, or the default */