]> Sergey Matveev's repositories - public-inbox.git/blobdiff - lib/PublicInbox/Config.pm
config: support "inboxdir" in addition to "mainrepo"
[public-inbox.git] / lib / PublicInbox / Config.pm
index 509de0a0b844784f6d8c05bbc5d1ac741dd4902b..2da202f99f6dd2e45729cb1a8dcca702d572c726 100644 (file)
@@ -93,7 +93,7 @@ sub each_inbox {
        # may auto-vivify if config file is non-existent:
        foreach my $section (@{$self->{-section_order}}) {
                next if $section !~ m!\Apublicinbox\.([^/]+)\z!;
-               defined($self->{"publicinbox.$1.mainrepo"}) or next;
+               defined($self->{"publicinbox.$1.inboxdir"}) or next;
                my $ibx = lookup_name($self, $1) or next;
                $cb->($ibx);
        }
@@ -362,12 +362,16 @@ sub _fill {
        my ($self, $pfx) = @_;
        my $ibx = {};
 
-       foreach my $k (qw(mainrepo filter url newsgroup
+       foreach my $k (qw(inboxdir filter url newsgroup
                        infourl watch watchheader httpbackendmax
                        replyto feedmax nntpserver indexlevel)) {
                my $v = $self->{"$pfx.$k"};
                $ibx->{$k} = $v if defined $v;
        }
+
+       # backwards compatibility:
+       $ibx->{inboxdir} //= $self->{"$pfx.mainrepo"};
+
        foreach my $k (qw(obfuscate)) {
                my $v = $self->{"$pfx.$k"};
                defined $v or next;
@@ -385,7 +389,7 @@ sub _fill {
                }
        }
 
-       return unless $ibx->{mainrepo};
+       return unless $ibx->{inboxdir};
        my $name = $pfx;
        $name =~ s/\Apublicinbox\.//;