[htdig3-dev] HTDIG_CONFIG_FILE env variables


Subject: [htdig3-dev] HTDIG_CONFIG_FILE env variables
From: Chuck O'Donnell (cao@bus.net)
Date: Mon Nov 20 2000 - 05:50:40 PST


I'm new to the list and I'm not sure if this has been previously
discussed. We have patched the release version of htdig (htdig-3.1.5)
to allow for environment variables specifying default config files and
directories under different Apache virtual domains. In our httpd.conf,
we use something like this:

<VirtualHost customer.domain>
    ServerName www.customer.domain
    ServerAdmin webmaster@customer.domain
    DocumentRoot /m/domain/customer.domain/htdocs/
    Alias /stats /m/domain/customer.domain/stats
    SetEnv HTDIG_CONFIG_DIR "/m/domain/customer.domain/etc/htdig"
    SetEnv HTDIG_CONFIG_FILE "/m/domain/customer.domain/etc/htdig/htdig.conf"
</VirtualHost>

This allows us to maintain different databases for each document tree,
and the customer doesn't have to remember to put

    <input type=hidden name=config value="...">

in the search form.

Below is the patch we use against the release sources. I would be
happy to supply a patch against current if anyone is interested. It
would be nice to have a feature like this enabled without having to
patch the sources on future installations.

Thanks all,

Chuck

>>>>>begin patch<<<<<
--- htsearch/htsearch.cc.orig Thu Feb 24 21:29:11 2000
+++ htsearch/htsearch.cc Sat Nov 4 16:12:22 2000
@@ -130,22 +130,30 @@
     config.Defaults(&defaults[0]);
     // To allow . in filename while still being 'secure',
     // e.g. htdig-f.q.d.n.conf
- if (!override_config && input.exists("config")
- && (strstr(input["config"], "./") == NULL))
+ if (!override_config)
     {
- char *configDir = getenv("CONFIG_DIR");
- if (configDir)
- {
- configFile = configDir;
- }
+ char *default_config_file = getenv("HTDIG_CONFIG_FILE");
+ if (default_config_file)
+ configFile = default_config_file;
        else
+ configFile = DEFAULT_CONFIG_FILE;
+ if (input.exists("config") && (strstr(input["config"], "./") == NULL))
        {
- configFile = CONFIG_DIR;
+ char *configDir = getenv("HTDIG_CONFIG_DIR");
+ if (configDir)
+ configFile = configDir;
+ else
+ configFile = CONFIG_DIR;
+ if (strlen(input["config"]) == 0)
+ {
+ if (default_config_file)
+ configFile = default_config_file;
+ else
+ configFile = DEFAULT_CONFIG_FILE;
+ }
+ else
+ configFile << '/' << input["config"] << ".conf";
        }
- if (strlen(input["config"]) == 0)
- configFile = DEFAULT_CONFIG_FILE;
- else
- configFile << '/' << input["config"] << ".conf";
     }
     if (access(configFile, R_OK) < 0)
     {
>>>>>end patch<<<<<

------------------------------------
To unsubscribe from the htdig3-dev mailing list, send a message to
htdig3-dev-unsubscribe@htdig.org
You will receive a message to confirm this.



This archive was generated by hypermail 2b28 : Mon Nov 20 2000 - 05:58:37 PST