[Web-SIG] RE: Standardised configuration.

Peter Hunt floydophone at gmail.com
Mon Sep 6 18:35:13 CEST 2004


I was actually thinking about this a week ago. First of all, I think
the configuration should be implemented as middleware. It will read a
configuration file or resource and stick it into environ["config"].
This way, we can have pluggable middleware which could, perhaps, take
their configuration from a remote server, local file, or other data
source.

The configuration middleware should be extensible and allow each
middleware to be configured (i.e.
environ["config"]["mymodule.gzip_middleware"]). Now I'm not a huge fan
of XML, but I think this would work okay:

<wsgi-config>
<middleware name="mymodule.gzip_middleware">
<!-- the data here can be arbitrary depending on how the middleware
wants to deal with it (plaintext or structured XML) -->
</middleware>
</wsgi-config>

Finally, I see a need for at least two different types of
configuration files. One has to be a "gateway" configuration. It sets
up general settings used by all applications on the server. This is
analagous to an httpd.conf file. For example, this is needed so shared
webhosting providers can set up generic services, such as storing
sessions on their RDBMS for speed purposes.

There also needs to be an "application" configuration file, for those
who want to set up application-specific services, such as gzip
encoding. My simple XML configuration format allows both configuration
of middleware, AND picking which middleware will be installed for a
request.

We also have to remember that applications may not have a working
directory. They might simply exist as Python functions inside of
BaseHTTPServer. Thus, the _gateway_ must instantiate the configuration
middleware for the gateway, AND it must instantiate the configuration
middleware for the application (if it exists).

i.e. mod_python would pick the gateway configuration file as the one
installed in the mod_python directory, and it would pick the
application configuration file as the one in the working directory of
the current script.

What do you think?


More information about the Web-SIG mailing list