David Ascher wrote:
> Would anyone else like it if the mechanism used for configuring a
> Quixote file could be used both for Quixote itself and for
> application-specific details?
>
> Put differently, how are people dealing with configuration files for
> their applications? I'm finding configuration to be somewhat of a
> hassle, especially as I want the configuration to be independent of the
> particular web server integration model (i.e. adding a line to the .cgi
> script doesn't work if you want the same app to be available through
> mod_python, etc.).
>
> I'm thinking it would be nice if there were a single .ini file, with a
> [QUIXOTE] section which defines all of the things currently in the .conf
> file, as well as other sections for other parts of the complete system.
>
> Thoughts?
>
> --david
Hi David,
I've tried to develop a component/service approach. I separate out
database, app logic, app ui, and http services into parts, and pull them
together with a "service manager" that glues them all together at
startup time.
The various components are initialized and plugged into a global service
lookup namespace. So, the 'http' component can discover the 'publisher'
and 'application' components, and bind itself to them. Sequence of
initialization is important, so I specify it in the config file.
It's a bit young yet, but I like the approach. I've worked almost
exclusively with the Medusa publisher, but I don't see why this wouldn't
work for mod_python, scgi, etc. I'd share code if anyone wants it, with
a 'work-in-progress' caveat.
Here's one of my configuration files -- following the Quixote
convention, it's just a python module.
# test_config.py
server_name = 'Test Server'
database = {
'name': 'windmill.services.database.ObjectDb',
'storetype': 'ZODB.FileStorage.FileStorage',
'storename': 'data/test.fs',
'pack_on_start': 1,
}
application = {
'name': 'test.application.Application',
'dbkey': 'test',
}
publisher = {
'name': 'windmill.publish.Publisher',
'ui': 'test.ui.application.ApplicationUI',
'secure_errors': 0,
}
http = {
'name': 'windmill.services.http.MedusaHandler',
'host': '',
'port' : 8080,
}
sequence = ['database', 'application', 'publisher', 'http']
main_service = 'http'
-- Graham