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',
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 {
}
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;