Don't blow up so much, but still not working
[catagits/Gitalist.git] / lib / Gitalist / Model / CollectionOfRepos.pm
index 9ac5f78..e9e6fb4 100644 (file)
@@ -97,24 +97,27 @@ sub _build_repos_dir {
         || $opts->{repos_dir} || $ENV{GITALIST_REPO_DIR} || undef;
 }
 
-sub BUILD {
-    my $self = shift;
+sub build_per_context_instance {
+    my ($self, $ctx) = @_;
+
     $self->class();
-    if ($self->repos_dir) { $self->repos_dir->resolve }
-}
 
-sub build_per_context_instance {
-    my ($self, $app) = @_;
+    if ($self->repos_dir) { $self->repos_dir->resolve }
 
     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 $ctx->debug;
+
+    return $class->new(%args);
 }
 
 __PACKAGE__->meta->make_immutable;