Pass the vhost in as a parameter
Tomas Doran [Sun, 13 Nov 2011 22:16:39 +0000 (22:16 +0000)]
lib/Gitalist/Model/CollectionOfRepos.pm

index 9ac5f78..1071d82 100644 (file)
@@ -104,17 +104,22 @@ sub BUILD {
 }
 
 sub build_per_context_instance {
-    my ($self, $app) = @_;
+    my ($self, $ctx) = @_;
 
     my %args = (
         export_ok => $self->export_ok || '',
         $self->_has_whitelist ? (whitelist => $self->whitelist) : (),
         repos => $self->repos,
         repo_dir => $self->repos_dir,
+        vhost => $ctx->request->uri->host,
         %{ $self->args }
     );
 
-    return $self->class->new(%args);
+    my $class = $self->class;
+
+    $ctx->log->debug("Using class '$class'") if $c->debug;
+
+    return $class->new(%args);
 }
 
 __PACKAGE__->meta->make_immutable;