I was just thinking about running single code, multiple data (several different TWiki sites, all with the same basic config, running off a single set of code). This has been asked for at various points in the past.
I'm wondering why this isn't trivial. Here's a little Cookbook approach to doing this (Dakar release only, though I guess you could do the same in Cairo)
Let's say you want to run two TWiki sites, one for "cats", and another for "dogs". You want two different URLs:
http://animaux.com/dogs/view
and
http://animaux.com/cats/view
. So you set up your httpd.conf as follows:
ScriptAlias /dogs/ "/twiki/dakar/bin"
ScriptAlias /cats/ "/twiki/dakar/bin"
Alias /dogs/ "/twiki/dogs/bin"
Alias /cats/ "/twiki/cats/"
Now, these two URL paths point to the same path, but the request URL is different in each case. The request URL can be recovered via an environment variable, so you can use that in
LocalSite.cfg to personalise the configuration:
$TWiki::cfg{DefaultUrlHost} = 'http://animaux.com';
$TWiki::cfg{TemplateDir} = '/twiki/dakar/templates';
$TWiki::cfg{LocalesDir} = '/twiki/dakar/locale';
if($ENV{REQUEST_URI} =~ m#/dogs/#) {
$TWiki::cfg{ScriptUrlPath} = '/dogs/bin';
$TWiki::cfg{DataDir} = '/twiki/dogs/data';
$TWiki::cfg{PubDir} = '/twiki/dogs/pub';
$TWiki::cfg{PubUrlPath} = '/dogs/pub';
} elsif( $ENV{REQUEST_URI} =~ m#/$cats/m) {
$TWiki::cfg{ScriptUrlPath} = '/cats/bin';
$TWiki::cfg{DataDir} = '/twiki/cats/data';
$TWiki::cfg{PubDir} = '/twiki/cats/pub';
$TWiki::cfg{PubUrlPath} = '/cats/pub';
}
You could 'personalise' all sorts of things; e.g. htpasswd paths. If you want to share dirs - such as the TWiki dir - you simply soft-link that dir into /twiki/cats/data= and
/twiki/dogs/data.
There are at least two potential problems with this:
- If you use
configure to change any of the "personalised" config vars in LocalSite.cfg, it will knacker the personalisation (though any other var should be OK)
- I haven't tried it, so I have no idea if it'll work!
--
CrawfordCurrie - 28 Nov 2005
CategoryCookbook