You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@httpd.apache.org by Nick Kew <ni...@webthing.com> on 2010/04/01 06:37:26 UTC

Re: [users@httpd] Conditionally process directives based on environment variable values in Apache conf?

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.
> 
> <IfMatch ${MYVAR1} "production">
>    # Directives related to production.
> </IfMatch>
> 
> <IfMatch ${MYVAR1} "test">
>    # Directives related to test.
> </IfMatch>
> 
> <IfMatch ${MYVAR1} "development">
>    # Directives related to development.
> </IfMatch>

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

You can do more with <If ....>, 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 <URL:http://httpd.apache.org/userslist.html> 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