1 # Copyright (C) 2014, Eric Wong <normalperson@yhbt.net> and all contributors
2 # License: AGPLv3 or later (https://www.gnu.org/licenses/agpl-3.0.txt)
3 package PublicInbox::Config;
7 # returns key-value pairs of config directives in a hash
9 my ($class, $file) = @_;
11 local $ENV{GIT_CONFIG} = $file;
13 my @cfg = `git config -l`;
14 $? == 0 or die "git config -l failed: $?\n";
16 my %rv = map { split(/=/, $_, 2) } @cfg;
21 my ($self, $recipient) = @_;
22 my $addr = lc($recipient);
25 foreach my $k (keys %$self) {
26 $k =~ /\A(publicinbox\.[A-Z0-9a-z-]+)\.address\z/ or next;
27 (lc($self->{$k}) eq $addr) or next;
32 defined $pfx or return;
35 $_ => $self->{"$pfx.$_"}
36 } (qw(mainrepo failrepo description address));