On Sat 20 Sep 2003, Jody Belka <belkajm-openguides-dev(a)aardvark-ss.com> wrote:
I'm running two OpenGuides sites, Birmingham and
Manchester. [...]
2) To determine which config file to load i extracted the first portion of
the domain name and used that as the filename.
[...]
2) It requires a master config file that is called 'openguides'. This file
is of the same style as the normal OpenGuides config file, but
currently only has one item, named 'config'. This item is evaluated as
a TT2 template, and has access to two lists, 'domain' and 'path',
which
contain the individual segments of their respective inputs.
For my installation, then, I would use this: config = [% domain.0 %]
How about we allow for require'ing a module OpenGuides::Local::Config
instead of this master config file. You will write that module
yourself to suit your site-specific requirements, and install it
wherever you normally install perl modules. If the module doesn't
exist then the default is to a simple 'wiki.conf' file in the current
directory.
Benefits of this over the master config file solution:
- It doesn't restrict you to only using $ENV{SERVER_NAME} and
$ENV{SCRIPT_NAME} to work out where the config file is - you can
use anything you can come up with to distinguish between sites.
- It's neater. I don't like the idea of using the sledgehammer of
the Template toolkit to crack the nut of extracting the first
element of an array.
- You can write tests for OpenGuides::Local::Config; trickier perhaps
for a plain config file.
Thoughts?
Kake