Nevermind, I found the answer on this page:

www.issociate.de/board/goto/1147159/Using_environment_variable_in_httpd.conf.html

Although it's an undocumented features, you can acess the OS env variables with 
a syntax like: ${WEBITEXT_HOME}.

I tried it and it works. The funny thing is that I am sure I tried this 3 weeks 
ago and it hadn't worked. Oh well.

Alain

-----Original Message-----
From: Desilets, Alain [mailto:alain.desil...@nrc-cnrc.gc.ca] 
Sent: Wednesday, January 25, 2012 6:51 AM
To: users@httpd.apache.org
Subject: [users@httpd] Can you use variables inside a conf file?

Hi, this is my first posting here.

I have a mod_perl application called WeBiText, which needs to push a number of 
directories on the Perl include path. At the moment, I do this by including the 
following in my httpd.conf file:

        PerlSwitches -IC:/Users/Desiletsa/Documents/eclipse_workspace/WeBiText
        PerlSwitches 
-IC:/Users/Desiletsa/Documents/eclipse_workspace/WeBiText/GUI
        PerlSwitches 
-IC:/Users/Desiletsa/Documents/eclipse_workspace/WeBiText/bin
        PerlSwitches 
-IC:/Users/Desiletsa/Documents/eclipse_workspace/IIPerlUtils/TestingAndDebugging
        PerlSwitches 
-IC:/Users/Desiletsa/Documents/eclipse_workspace/IIPerlUtils
        PerlSwitches 
-IC:/Users/Desiletsa/Documents/eclipse_workspace/PerlCorpusMiner

This is not great, because it hardcodes the pathes into the httpd.conf, which 
means that they possibly have to be changed everytime I install the app on a 
different machine.

I would much prefer to write something like this:

        PerlSwitches -I$ENV{WEBITEXT_HOME}/WeBiText
        PerlSwitches -I$ENV{WEBITEXT_HOME}/WeBiText/GUI
        PerlSwitches -I$ENV{WEBITEXT_HOME}/WeBiText/bin
        PerlSwitches -I$ENV{WEBITEXT_HOME}/IIPerlUtils/TestingAndDebugging
        PerlSwitches -I$ENV{WEBITEXT_HOME}/IIPerlUtils
        PerlSwitches -I$ENV{WEBITEXT_HOME}/PerlCorpusMiner

where WEBITEXT_HOME is an OS environment variable which already needs to be set 
for other reasons. Alternatively, I would be OK with using $WEBITEXT_HOME 
instead of $ENV{WEBITEXT_HOME}, where $WEBITEXT_HOME would be a variable whose 
value is passed to httpd using a command line option.

Is this possible? I looked around on the web and it seems that OS environment 
variables can only be accessed inside <Perl> sections. And unfortunately, I 
can't use <Perl> sections for that specific purpose, because those sections can 
only appear after you have loaded mod_perl, and by then it's already too late 
to modify the Perl include path.

Any help would be appreciated.

Thx.

Alain

---------------------------------------------------------------------
The official User-To-User support forum of the Apache HTTP Server Project.
See <URL:http://httpd.apache.org/userslist.html> for more info.
To unsubscribe, e-mail: users-unsubscr...@httpd.apache.org
   "   from the digest: users-digest-unsubscr...@httpd.apache.org
For additional commands, e-mail: users-h...@httpd.apache.org


---------------------------------------------------------------------
The official User-To-User support forum of the Apache HTTP Server Project.
See <URL:http://httpd.apache.org/userslist.html> for more info.
To unsubscribe, e-mail: users-unsubscr...@httpd.apache.org
   "   from the digest: users-digest-unsubscr...@httpd.apache.org
For additional commands, e-mail: users-h...@httpd.apache.org

Reply via email to