Virtualhosts, SetEnv and initial-env

"Vetle Roeim" <[email protected]>
Newsgroups gmane.comp.web.fastcgi.devel,gmane.spam.detected
Message-ID <[email protected]>
Hi,

I'm having some issues with the combination of Apache, fastcgi, web.py
and setting environment variables per virtual hosts. Basically it's
not working at all, which is probably because I'm not understanding
how it should work, but perhaps you can help me to figure out how I
can achieve what I want to do.

The idea is that each virtual host needs a separate config file, which
is read in the python code. This is to enable a single server to serve
different web sites, and the configuration filename does not have to
be hardcoded in the code.

So, in the virtual host configurations, I do:
SetEnv CONFFILE "/path/to/conf/file"

In httpd.conf, I have:
FastCgiConfig (lots of stuff) -initial-env CONFFILE

In my Python code, I do:
if 'CONFFILE' in os.environ:
  conffile = os.environ['CONFFILE']

This fails horribly, w/o any error message from fastcgi (not even
"incomplete headers"). If I comment out the last line, it works, and
I've also verified that it does enter into the if-test. CONFFILE is in
os.environ, but trying to get it fails.

I've tried to catch exceptions and print it to file, but that code is
never reached. Now, I know web.py moves the environment variables to
web.ctx.env, but this code is run before web.run is called, and I've
also checked if web.ctx.env contains CONFFILE, but it doesn't.

This is giving me a headache, so any pointers in the right direction
would be appriciated. Suggestions of other ways of having
configuration per virtual host would also be appriciated.

Thanks,
-- 
Vetle Roeim
___________________________________
fastcgi-developers mailing list
http://fastcgi.com/fastcgi-developers/
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.