RE: Can you use variables inside a conf file?

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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.Desilets@xxxxxxxxxxxxxx] 
Sent: Wednesday, January 25, 2012 6:51 AM
To: users@xxxxxxxxxxxxxxxx
Subject:  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-unsubscribe@xxxxxxxxxxxxxxxx
   "   from the digest: users-digest-unsubscribe@xxxxxxxxxxxxxxxx
For additional commands, e-mail: users-help@xxxxxxxxxxxxxxxx


---------------------------------------------------------------------
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-unsubscribe@xxxxxxxxxxxxxxxx
   "   from the digest: users-digest-unsubscribe@xxxxxxxxxxxxxxxx
For additional commands, e-mail: users-help@xxxxxxxxxxxxxxxx




[Index of Archives]     [Open SSH Users]     [Linux ACPI]     [Linux Kernel]     [Linux Laptop]     [Kernel Newbies]     [Security]     [Netfilter]     [Bugtraq]     [Squid]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Samba]     [Video 4 Linux]     [Device Mapper]

  Powered by Linux