Conditionally process directives based on environment variable values

Conditionally process directives based on environment variable values

am 31.03.2010 20:16:08 von Jeffery Martin

Hello,

Is there a way in the Apache conf syntax to conditionally process
directives based on a string comparison using environment variables?

I am aware of using the IfDefine directive and the -D flag of httpd,
but that functionality is not quite when I am looking for.

For example, suppose the directive I am looking for were named
"IfMatch". I would want to do something like this.


# Directives related to production.



# Directives related to test.



# Directives related to development.


I realize that I could do the equivalent with IfDefine and 3 different
define parameters, but I am wondering if it is possible to perform the
string comparison within the Apache conf itself as I detailed above.


Thanks, All.

------------------------------------------------------------ ---------
The official User-To-User support forum of the Apache HTTP Server Project.
See for more info.
To unsubscribe, e-mail: users-unsubscribe@httpd.apache.org
" from the digest: users-digest-unsubscribe@httpd.apache.org
For additional commands, e-mail: users-help@httpd.apache.org

Re: Conditionally process directives based on environment variable

am 31.03.2010 21:28:32 von Jeffery Martin

I found this in the mail archives.

http://mail-archives.apache.org/mod_mbox/httpd-users/200601. mbox/%3Ce498c16=
60601190620i664df153y2bbbbd8f7aa2a9d7@mail.gmail.com%3E

"But the standard advice in cases like this is: httpd.conf is not a
programming language, it is a config file. If you need more advanced
features, then use your favorite preprocess (m4, etc) to generate your
config files."

This certainly applies to my situation, and I was thinking something
similar. Still, the Apache httpd conf syntax is quite powerful, so my
question still seemed worth asking.



On Wed, Mar 31, 2010 at 1:16 PM, Jeffery Martin wrote:
> Hello,
>
> Is there a way in the Apache conf syntax to conditionally process
> directives based on a string comparison using environment variables?
>
> I am aware of using the IfDefine directive and the -D flag of httpd,
> but that functionality is not quite when I am looking for.
>
> For example, suppose the directive I am looking for were named
> "IfMatch". =A0I would want to do something like this.
>
>
> =A0 =A0# Directives related to production.
>

>
>
> =A0 =A0# Directives related to test.
>

>
>
> =A0 =A0# Directives related to development.
>

>
> I realize that I could do the equivalent with IfDefine and 3 different
> define parameters, but I am wondering if it is possible to perform the
> string comparison within the Apache conf itself as I detailed above.
>
>
> Thanks, All.
>



--=20
Jeffery Martin

------------------------------------------------------------ ---------
The official User-To-User support forum of the Apache HTTP Server Project.
See for more info.
To unsubscribe, e-mail: users-unsubscribe@httpd.apache.org
" from the digest: users-digest-unsubscribe@httpd.apache.org
For additional commands, e-mail: users-help@httpd.apache.org

Re: Re: Conditionally process directives based on environmentvariable values in Apache conf?

am 01.04.2010 03:48:25 von Nilesh Govindrajan

On 04/01/10 00:58, Jeffery Martin wrote:
> I found this in the mail archives.
>
> http://mail-archives.apache.org/mod_mbox/httpd-users/200601. mbox/%3Ce498c1660601190620i664df153y2bbbbd8f7aa2a9d7@mail.gm ail.com%3E
>
> "But the standard advice in cases like this is: httpd.conf is not a
> programming language, it is a config file. If you need more advanced
> features, then use your favorite preprocess (m4, etc) to generate your
> config files."
>
> This certainly applies to my situation, and I was thinking something
> similar. Still, the Apache httpd conf syntax is quite powerful, so my
> question still seemed worth asking.
>
>
>
> On Wed, Mar 31, 2010 at 1:16 PM, Jeffery Martin wrote:
>> Hello,
>>
>> Is there a way in the Apache conf syntax to conditionally process
>> directives based on a string comparison using environment variables?
>>
>> I am aware of using the IfDefine directive and the -D flag of httpd,
>> but that functionality is not quite when I am looking for.
>>
>> For example, suppose the directive I am looking for were named
>> "IfMatch". I would want to do something like this.
>>
>>
>> # Directives related to production.
>>

>>
>>
>> # Directives related to test.
>>

>>
>>
>> # Directives related to development.
>>

>>
>> I realize that I could do the equivalent with IfDefine and 3 different
>> define parameters, but I am wondering if it is possible to perform the
>> string comparison within the Apache conf itself as I detailed above.
>>
>>
>> Thanks, All.
>>
>
>
>

With 2.3 coming, httpd.conf will support LUA as per the announcement. So
you need to wait till 2.3 is out. :)

--
Nilesh Govindarajan
Site & Server Administrator
www.itech7.com
मेरा भारत महान !
मम भारत: महत्तम भवतु !

------------------------------------------------------------ ---------
The official User-To-User support forum of the Apache HTTP Server Project.
See for more info.
To unsubscribe, e-mail: users-unsubscribe@httpd.apache.org
" from the digest: users-digest-unsubscribe@httpd.apache.org
For additional commands, e-mail: users-help@httpd.apache.org

Re: Re: Conditionally process directives based on

am 01.04.2010 05:34:16 von Jeffery Martin

Hmmm, in other words, use mod_perl, then, right?

On Wed, Mar 31, 2010 at 8:48 PM, Nilesh Govindarajan wro=
te:
> On 04/01/10 00:58, Jeffery Martin wrote:
>>
>> I found this in the mail archives.
>>
>>
>> http://mail-archives.apache.org/mod_mbox/httpd-users/200601. mbox/%3Ce498=
c1660601190620i664df153y2bbbbd8f7aa2a9d7@mail.gmail.com%3E
>>
>> "But the standard advice in cases like this is: httpd.conf is not a
>> programming language, it is a config file.  If you need more advanc=
ed
>> features, then use your favorite preprocess (m4, etc) to generate your
>> config files."
>>
>> This certainly applies to my situation, and I was thinking something
>> similar.  Still, the Apache httpd conf syntax is quite powerful, so=
my
>> question still seemed worth asking.
>>
>>
>>
>> On Wed, Mar 31, 2010 at 1:16 PM, Jeffery Martin =C2=
=A0wrote:
>>>
>>> Hello,
>>>
>>> Is there a way in the Apache conf syntax to conditionally process
>>> directives based on a string comparison using environment variables?
>>>
>>> I am aware of using the IfDefine directive and the -D flag of httpd,
>>> but that functionality is not quite when I am looking for.
>>>
>>> For example, suppose the directive I am looking for were named
>>> "IfMatch".  I would want to do something like this.
>>>
>>>
>>>    # Directives related to production.
>>>

>>>
>>>
>>>    # Directives related to test.
>>>

>>>
>>>
>>>    # Directives related to development.
>>>

>>>
>>> I realize that I could do the equivalent with IfDefine and 3 different
>>> define parameters, but I am wondering if it is possible to perform the
>>> string comparison within the Apache conf itself as I detailed above.
>>>
>>>
>>> Thanks, All.
>>>
>>
>>
>>
>
> With 2.3 coming, httpd.conf will support LUA as per the announcement. So =
you
> need to wait till 2.3 is out. :)
>
> --
> Nilesh Govindarajan
> Site & Server Administrator
> www.itech7.com
> मेरा भारत=
महान !
> मम भारत: मà=A4=
¹à¤¤à¥à¤¤à¤=AE भवतà=A5=
=81 !
>
> ------------------------------------------------------------ ---------
> The official User-To-User support forum of the Apache HTTP Server Project=
..
> See for more info.
> To unsubscribe, e-mail: users-unsubscribe@httpd.apache.org
>  "   from the digest: users-digest-unsubscribe@httpd.apache.org
> For additional commands, e-mail: users-help@httpd.apache.org
>
>

------------------------------------------------------------ ---------
The official User-To-User support forum of the Apache HTTP Server Project.
See for more info.
To unsubscribe, e-mail: users-unsubscribe@httpd.apache.org
" from the digest: users-digest-unsubscribe@httpd.apache.org
For additional commands, e-mail: users-help@httpd.apache.org

Re: Conditionally process directives based on environment variable values in Apache conf?

am 01.04.2010 06:37:26 von Nick Kew

On 31 Mar 2010, at 19:16, Jeffery Martin wrote:

> For example, suppose the directive I am looking for were named
> "IfMatch". I would want to do something like this.
>
>
> # Directives related to production.
>

>
>
> # Directives related to test.
>

>
>
> # Directives related to development.
>


The easy/clean way to implement that would be in apachectl.
You use three s, and pick the right one from your MYVAR1
within apachectl.

You can do more with , and of course a great deal more with
a scripting language. But that would be overkill for selecting from a
menu of pre-defined options.

--
Nick Kew

------------------------------------------------------------ ---------
The official User-To-User support forum of the Apache HTTP Server Project.
See for more info.
To unsubscribe, e-mail: users-unsubscribe@httpd.apache.org
" from the digest: users-digest-unsubscribe@httpd.apache.org
For additional commands, e-mail: users-help@httpd.apache.org