X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=blobdiff_plain;f=lib%2FGitalist%2FModel%2FCollectionOfRepos.pm;h=1071d82f3de0f9d360b222f2a28985a1340d8487;hb=2a285433482e95730447a82158092929efc50aad;hp=e8df7470bc45a8975094b55e04e91385fc873b0e;hpb=ea7725112cb1e27f0c76481742daad900380b8cd;p=catagits%2FGitalist.git diff --git a/lib/Gitalist/Model/CollectionOfRepos.pm b/lib/Gitalist/Model/CollectionOfRepos.pm index e8df747..1071d82 100644 --- a/lib/Gitalist/Model/CollectionOfRepos.pm +++ b/lib/Gitalist/Model/CollectionOfRepos.pm @@ -67,6 +67,13 @@ has whitelist => ( predicate => '_has_whitelist', ); +has repo_dir => ( + is => 'ro', + isa => DirOrUndef, + coerce => 1, + predicate => '_has_repo_dir', +); + # Simple directory of repositories (for list) has repos_dir => ( is => 'ro', @@ -85,7 +92,9 @@ has repos => ( sub _build_repos_dir { my $self = shift; - my $dir = $self->_application->run_options->{repo_dir} || $ENV{GITALIST_REPO_DIR } || undef; + my $opts = $self->_application->run_options || {}; + return $self->_has_repo_dir && $self->repo_dir + || $opts->{repos_dir} || $ENV{GITALIST_REPO_DIR} || undef; } sub BUILD { @@ -95,19 +104,20 @@ 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 } ); my $class = $self->class; - $app->log->debug("Using class '$class'"); + $ctx->log->debug("Using class '$class'") if $c->debug; return $class->new(%args); }