Graham Leggett wrote:
Hi all,

I have just been picking apart the way that environment variables are handled at config time within httpd, and there seems to be some overloading on concepts that has caused some confusion.

There are two environments within httpd, the first is the read only system environment that is read using getenv(), the second is the server->vars table that is read/write using mod_env and friends.

A recent addition was made (it's on trunk and 2.2) that allows httpd to include system variables in config directives, like this:

DocumentRoot ${DOCUMENT_ROOT}

The system environment variable DOCUMENT_ROOT is parsed and placed in the config line, so far so good.

Actually the feature is just undocumented, and has existed since 2.0 (maybe 1.3 too?)

What isn't possible however, is this:

SetEnv WEBAPP app1
<Location /${WEBAPP}>
  ServerAdmin [EMAIL PROTECTED]
  ... other cool template style stuff ...
</Location>

In this case, SetEnv sets a variable within mod_env's server->vars, but this is ignored by ap_resolve_env, and so doesn't work as the user might expect it to.

-0, I would prefer to use a 'real' template language for configs, rather than continuing to expand our current hacks upon hacks.

-Paul

Reply via email to