I've added a new hook into the Maypole request process - preprocess_location - allows you to do what it says on the tin - you can rewrite urls, or as I've done today - you can set configuration per request based on hostname and path..
sub preprocess_location {
my $self = shift;
# get uri base, template_paths, client, etc from url
my $site_config = My::Config->get_site(scheme=>'http', host=>$self->headers_in->get('host'), path => $self->ar->uri);
$self->config->additional->{site_config} = $site_config;
$self->config->additional->{client_id} = $site_config->client_id;
$self->config->uri_base($site_config->base_uri);
my $custom_path = $site_config->custom_path;
if ($custom_path) {
my $default_path = $ENV{TEMPLATE_ROOT};
my $template_paths = [ $custom_path, $default_path ];
$self->config->template_root($template_paths);
}
return;
}
The Config package in turn uses Config::Context to load per host/path configuration from an apache style config file.
sweeeeet