about summary refs log tree commit homepage
diff options
context:
space:
mode:
-rw-r--r--examples/cgit.psgi4
-rw-r--r--lib/PublicInbox/Cgit.pm24
-rw-r--r--lib/PublicInbox/Config.pm2
-rw-r--r--lib/PublicInbox/ExtMsg.pm8
-rw-r--r--lib/PublicInbox/IMAPD.pm28
-rw-r--r--lib/PublicInbox/Inbox.pm10
-rw-r--r--lib/PublicInbox/InboxIdle.pm9
-rw-r--r--lib/PublicInbox/MDA.pm4
-rw-r--r--lib/PublicInbox/ManifestJsGz.pm2
-rw-r--r--lib/PublicInbox/NNTP.pm22
-rw-r--r--lib/PublicInbox/NNTPD.pm16
-rw-r--r--lib/PublicInbox/NewsWWW.pm15
-rw-r--r--lib/PublicInbox/Qspawn.pm4
-rw-r--r--lib/PublicInbox/Spamcheck.pm4
-rw-r--r--lib/PublicInbox/Unsubscribe.pm6
-rw-r--r--lib/PublicInbox/WWW.pm27
-rw-r--r--lib/PublicInbox/Watch.pm20
-rw-r--r--lib/PublicInbox/WwwListing.pm4
-rw-r--r--lib/PublicInbox/WwwStream.pm2
-rw-r--r--lib/PublicInbox/WwwText.pm4
-rwxr-xr-xscript/public-inbox-learn8
-rwxr-xr-xscript/public-inbox-mda8
-rwxr-xr-xscripts/import_slrnspool4
-rw-r--r--t/imapd.t4
-rw-r--r--t/inbox_idle.t8
-rw-r--r--t/mda_filter_rubylang.t4
-rw-r--r--t/nntp.t2
-rw-r--r--t/psgi_mount.t6
-rw-r--r--t/psgi_search.t6
-rw-r--r--t/psgi_v2.t11
-rw-r--r--t/watch_filter_rubylang.t10
-rw-r--r--t/watch_maildir.t26
-rw-r--r--t/watch_maildir_v2.t48
-rw-r--r--t/watch_multiple_headers.t8
34 files changed, 182 insertions, 186 deletions
diff --git a/examples/cgit.psgi b/examples/cgit.psgi
index 7ad38e28..48e3798b 100644
--- a/examples/cgit.psgi
+++ b/examples/cgit.psgi
@@ -14,8 +14,8 @@ use warnings;
 use Plack::Builder;
 use PublicInbox::Cgit;
 use PublicInbox::Config;
-my $pi_config = PublicInbox::Config->new;
-my $cgit = PublicInbox::Cgit->new($pi_config);
+my $pi_cfg = PublicInbox::Config->new;
+my $cgit = PublicInbox::Cgit->new($pi_cfg);
 
 builder {
         eval { enable 'ReverseProxy' };
diff --git a/lib/PublicInbox/Cgit.pm b/lib/PublicInbox/Cgit.pm
index fb0d0e60..472509a8 100644
--- a/lib/PublicInbox/Cgit.pm
+++ b/lib/PublicInbox/Cgit.pm
@@ -16,9 +16,9 @@ use PublicInbox::Qspawn;
 use PublicInbox::WwwStatic qw(r);
 
 sub locate_cgit ($) {
-        my ($pi_config) = @_;
-        my $cgit_bin = $pi_config->{'publicinbox.cgitbin'};
-        my $cgit_data = $pi_config->{'publicinbox.cgitdata'};
+        my ($pi_cfg) = @_;
+        my $cgit_bin = $pi_cfg->{'publicinbox.cgitbin'};
+        my $cgit_data = $pi_cfg->{'publicinbox.cgitdata'};
 
         # /var/www/htdocs/cgit is the default install path from cgit.git
         # /usr/{lib,share}/cgit is where Debian puts cgit
@@ -51,28 +51,28 @@ sub locate_cgit ($) {
 }
 
 sub new {
-        my ($class, $pi_config) = @_;
-        my ($cgit_bin, $cgit_data) = locate_cgit($pi_config);
+        my ($class, $pi_cfg) = @_;
+        my ($cgit_bin, $cgit_data) = locate_cgit($pi_cfg);
 
         my $self = bless {
                 cmd => [ $cgit_bin ],
                 cgit_data => $cgit_data,
-                pi_config => $pi_config,
+                pi_cfg => $pi_cfg,
         }, $class;
 
-        $pi_config->fill_all; # fill in -code_repos mapped to inboxes
+        $pi_cfg->fill_all; # fill in -code_repos mapped to inboxes
 
         # some cgit repos may not be mapped to inboxes, so ensure those exist:
-        my $code_repos = $pi_config->{-code_repos};
-        foreach my $k (keys %$pi_config) {
+        my $code_repos = $pi_cfg->{-code_repos};
+        foreach my $k (keys %$pi_cfg) {
                 $k =~ /\Acoderepo\.(.+)\.dir\z/ or next;
-                my $dir = $pi_config->{$k};
+                my $dir = $pi_cfg->{$k};
                 $code_repos->{$1} ||= PublicInbox::Git->new($dir);
         }
         while (my ($nick, $repo) = each %$code_repos) {
                 $self->{"\0$nick"} = $repo;
         }
-        my $cgit_static = $pi_config->{-cgit_static};
+        my $cgit_static = $pi_cfg->{-cgit_static};
         my $static = join('|', map { quotemeta $_ } keys %$cgit_static);
         $self->{static} = qr/\A($static)\z/;
         $self;
@@ -120,7 +120,7 @@ sub call {
 
         my $rdr = input_prepare($env) or return r(500);
         my $qsp = PublicInbox::Qspawn->new($self->{cmd}, $cgi_env, $rdr);
-        my $limiter = $self->{pi_config}->limiter('-cgit');
+        my $limiter = $self->{pi_cfg}->limiter('-cgit');
         $qsp->psgi_return($env, $limiter, $parse_cgi_headers);
 }
 
diff --git a/lib/PublicInbox/Config.pm b/lib/PublicInbox/Config.pm
index 1844f8b2..cafd9c3b 100644
--- a/lib/PublicInbox/Config.pm
+++ b/lib/PublicInbox/Config.pm
@@ -425,7 +425,7 @@ EOF
         }
 
         $ibx->{name} = $name;
-        $ibx->{-pi_config} = $self;
+        $ibx->{-pi_cfg} = $self;
         $ibx = PublicInbox::Inbox->new($ibx);
         foreach (@{$ibx->{address}}) {
                 my $lc_addr = lc($_);
diff --git a/lib/PublicInbox/ExtMsg.pm b/lib/PublicInbox/ExtMsg.pm
index 43acfb53..8da96df6 100644
--- a/lib/PublicInbox/ExtMsg.pm
+++ b/lib/PublicInbox/ExtMsg.pm
@@ -105,8 +105,8 @@ sub ext_msg_step {
 
 sub ext_msg_ALL ($) {
         my ($ctx) = @_;
-        my $ALL = $ctx->{www}->{pi_config}->ALL or return;
-        my $by_eidx_key = $ctx->{www}->{pi_config}->{-by_eidx_key};
+        my $ALL = $ctx->{www}->{pi_cfg}->ALL or return;
+        my $by_eidx_key = $ctx->{www}->{pi_cfg}->{-by_eidx_key};
         my $cur_key = $ctx->{ibx}->eidx_key;
         my %seen = ($cur_key => 1);
         my ($id, $prev);
@@ -139,11 +139,11 @@ sub ext_msg {
                 if ($ctx->{env}->{'pi-httpd.async'}) {
                         require PublicInbox::ConfigIter;
                         my $iter = PublicInbox::ConfigIter->new(
-                                                $ctx->{www}->{pi_config},
+                                                $ctx->{www}->{pi_cfg},
                                                 \&ext_msg_step, $ctx);
                         $iter->event_step;
                 } else {
-                        $ctx->{www}->{pi_config}->each_inbox(\&ext_msg_i, $ctx);
+                        $ctx->{www}->{pi_cfg}->each_inbox(\&ext_msg_i, $ctx);
                         finalize_exact($ctx);
                 }
         };
diff --git a/lib/PublicInbox/IMAPD.pm b/lib/PublicInbox/IMAPD.pm
index 4a37734e..fb945847 100644
--- a/lib/PublicInbox/IMAPD.pm
+++ b/lib/PublicInbox/IMAPD.pm
@@ -19,12 +19,12 @@ sub new {
                 err => \*STDERR,
                 out => \*STDOUT,
                 # accept_tls => { SSL_server => 1, ..., SSL_reuse_ctx => ... }
-                # pi_config => PublicInbox::Config
+                # pi_cfg => PublicInbox::Config
                 # idler => PublicInbox::InboxIdle
         }, $class;
 }
 
-sub imapd_refresh_ibx { # pi_config->each_inbox cb
+sub imapd_refresh_ibx { # pi_cfg->each_inbox cb
         my ($ibx, $imapd) = @_;
         my $ngname = $ibx->{newsgroup} or return;
 
@@ -60,7 +60,7 @@ sub imapd_refresh_ibx { # pi_config->each_inbox cb
 }
 
 sub imapd_refresh_finalize {
-        my ($imapd, $pi_config) = @_;
+        my ($imapd, $pi_cfg) = @_;
         my $mailboxes;
         if (my $next = delete $imapd->{imapd_next}) {
                 $imapd->{mailboxes} = delete $next->{mailboxes};
@@ -78,40 +78,40 @@ sub imapd_refresh_finalize {
                         qq[* LIST (\\Has${no}Children) "." $u\r\n]
                 } keys %$mailboxes
         ];
-        $imapd->{pi_config} = $pi_config;
+        $imapd->{pi_cfg} = $pi_cfg;
         if (my $idler = $imapd->{idler}) {
-                $idler->refresh($pi_config);
+                $idler->refresh($pi_cfg);
         }
 }
 
-sub imapd_refresh_step { # pi_config->iterate_start cb
-        my ($pi_config, $section, $imapd) = @_;
+sub imapd_refresh_step { # pi_cfg->iterate_start cb
+        my ($pi_cfg, $section, $imapd) = @_;
         if (defined($section)) {
                 return if $section !~ m!\Apublicinbox\.([^/]+)\z!;
-                my $ibx = $pi_config->lookup_name($1) or return;
+                my $ibx = $pi_cfg->lookup_name($1) or return;
                 imapd_refresh_ibx($ibx, $imapd->{imapd_next});
         } else { # undef == "EOF"
-                imapd_refresh_finalize($imapd, $pi_config);
+                imapd_refresh_finalize($imapd, $pi_cfg);
         }
 }
 
 sub refresh_groups {
         my ($self, $sig) = @_;
-        my $pi_config = PublicInbox::Config->new;
+        my $pi_cfg = PublicInbox::Config->new;
         if ($sig) { # SIGHUP is handled through the event loop
                 $self->{imapd_next} = { dummies => {}, mailboxes => {} };
-                my $iter = PublicInbox::ConfigIter->new($pi_config,
+                my $iter = PublicInbox::ConfigIter->new($pi_cfg,
                                                 \&imapd_refresh_step, $self);
                 $iter->event_step;
         } else { # initial start is synchronous
                 $self->{dummies} = {};
-                $pi_config->each_inbox(\&imapd_refresh_ibx, $self);
-                imapd_refresh_finalize($self, $pi_config);
+                $pi_cfg->each_inbox(\&imapd_refresh_ibx, $self);
+                imapd_refresh_finalize($self, $pi_cfg);
         }
 }
 
 sub idler_start {
-        $_[0]->{idler} //= PublicInbox::InboxIdle->new($_[0]->{pi_config});
+        $_[0]->{idler} //= PublicInbox::InboxIdle->new($_[0]->{pi_cfg});
 }
 
 1;
diff --git a/lib/PublicInbox/Inbox.pm b/lib/PublicInbox/Inbox.pm
index 52aece7c..586bd561 100644
--- a/lib/PublicInbox/Inbox.pm
+++ b/lib/PublicInbox/Inbox.pm
@@ -85,7 +85,7 @@ sub _set_uint ($$$) {
 }
 
 sub _set_limiter ($$$) {
-        my ($self, $pi_config, $pfx) = @_;
+        my ($self, $pi_cfg, $pfx) = @_;
         my $lkey = "-${pfx}_limiter";
         $self->{$lkey} ||= do {
                 # full key is: publicinbox.$NAME.httpbackendmax
@@ -96,7 +96,7 @@ sub _set_limiter ($$$) {
                         require PublicInbox::Qspawn;
                         $lim = PublicInbox::Qspawn::Limiter->new($val);
                 } elsif ($val =~ /\A[a-z][a-z0-9]*\z/) {
-                        $lim = $pi_config->limiter($val);
+                        $lim = $pi_cfg->limiter($val);
                         warn "$mkey limiter=$val not found\n" if !$lim;
                 } else {
                         warn "$mkey limiter=$val not understood\n";
@@ -110,10 +110,10 @@ sub new {
         my $v = $opts->{address} ||= [ 'public-inbox@example.com' ];
         my $p = $opts->{-primary_address} = ref($v) eq 'ARRAY' ? $v->[0] : $v;
         $opts->{domain} = ($p =~ /\@(\S+)\z/) ? $1 : 'localhost';
-        my $pi_config = delete $opts->{-pi_config};
-        _set_limiter($opts, $pi_config, 'httpbackend');
+        my $pi_cfg = delete $opts->{-pi_cfg};
+        _set_limiter($opts, $pi_cfg, 'httpbackend');
         _set_uint($opts, 'feedmax', 25);
-        $opts->{nntpserver} ||= $pi_config->{'publicinbox.nntpserver'};
+        $opts->{nntpserver} ||= $pi_cfg->{'publicinbox.nntpserver'};
         my $dir = $opts->{inboxdir};
         if (defined $dir && -f "$dir/inbox.lock") {
                 $opts->{version} = 2;
diff --git a/lib/PublicInbox/InboxIdle.pm b/lib/PublicInbox/InboxIdle.pm
index 0cdd2e2a..2737bbbd 100644
--- a/lib/PublicInbox/InboxIdle.pm
+++ b/lib/PublicInbox/InboxIdle.pm
@@ -2,7 +2,6 @@
 # License: AGPL-3.0+ <https://www.gnu.org/licenses/agpl-3.0.txt>
 
 # fields:
-# pi_config: PublicInbox::Config ref
 # inot: Linux::Inotify2-like object
 # pathmap => { inboxdir => [ ibx, watch1, watch2, watch3... ] } mapping
 package PublicInbox::InboxIdle;
@@ -51,12 +50,12 @@ sub in2_arm ($$) { # PublicInbox::Config::each_inbox callback
 }
 
 sub refresh {
-        my ($self, $pi_config) = @_;
-        $pi_config->each_inbox(\&in2_arm, $self);
+        my ($self, $pi_cfg) = @_;
+        $pi_cfg->each_inbox(\&in2_arm, $self);
 }
 
 sub new {
-        my ($class, $pi_config) = @_;
+        my ($class, $pi_cfg) = @_;
         my $self = bless {}, $class;
         my $inot;
         if ($ino_cls) {
@@ -70,7 +69,7 @@ sub new {
         $self->{inot} = $inot;
         $self->{pathmap} = {}; # inboxdir => [ ibx, watch1, watch2, watch3...]
         $self->{on_unlock} = {}; # lock path => ibx
-        refresh($self, $pi_config);
+        refresh($self, $pi_cfg);
         PublicInbox::FakeInotify::poll_once($self) if !$ino_cls;
         $self;
 }
diff --git a/lib/PublicInbox/MDA.pm b/lib/PublicInbox/MDA.pm
index fa4a2ad8..0377a877 100644
--- a/lib/PublicInbox/MDA.pm
+++ b/lib/PublicInbox/MDA.pm
@@ -83,7 +83,7 @@ sub set_list_headers {
 }
 
 sub inboxes_for_list_id ($$) {
-        my ($klass, $config, $simple) = @_;
+        my ($klass, $pi_cfg, $simple) = @_;
 
         # newer Email::Simple allows header_raw, as does Email::MIME:
         my @list_ids = $simple->can('header_raw') ?
@@ -92,7 +92,7 @@ sub inboxes_for_list_id ($$) {
         my @dests;
         for my $list_id (@list_ids) {
                 $list_id =~ /<[ \t]*(.+)?[ \t]*>/ or next;
-                if (my $ibx = $config->lookup_list_id($1)) {
+                if (my $ibx = $pi_cfg->lookup_list_id($1)) {
                         push @dests, $ibx;
                 }
         }
diff --git a/lib/PublicInbox/ManifestJsGz.pm b/lib/PublicInbox/ManifestJsGz.pm
index 2c4a231d..fb7a45e7 100644
--- a/lib/PublicInbox/ManifestJsGz.pm
+++ b/lib/PublicInbox/ManifestJsGz.pm
@@ -71,7 +71,7 @@ sub eidx_manifest_add ($$$) {
 
 sub ibx_entry {
         my ($ctx, $ibx) = @_;
-        my $ALL = $ctx->{www}->{pi_config}->ALL;
+        my $ALL = $ctx->{www}->{pi_cfg}->ALL;
         if ($ALL) {
                 eidx_manifest_add($ctx, $ALL, $ibx);
         } else {
diff --git a/lib/PublicInbox/NNTP.pm b/lib/PublicInbox/NNTP.pm
index 766ea89e..0b43cdbc 100644
--- a/lib/PublicInbox/NNTP.pm
+++ b/lib/PublicInbox/NNTP.pm
@@ -129,7 +129,7 @@ sub list_active_i { # "LIST ACTIVE" and also just "LIST" (no args)
         my ($self, $groupnames) = @_;
         my @window = splice(@$groupnames, 0, 100) or return 0;
         my $ibx;
-        my $groups = $self->{nntpd}->{pi_config}->{-by_newsgroup};
+        my $groups = $self->{nntpd}->{pi_cfg}->{-by_newsgroup};
         for my $ngname (@window) {
                 $ibx = $groups->{$ngname} and group_line($self, $ibx);
         }
@@ -146,7 +146,7 @@ sub list_active ($;$) { # called by cmd_list
 sub list_active_times_i {
         my ($self, $groupnames) = @_;
         my @window = splice(@$groupnames, 0, 100) or return 0;
-        my $groups = $self->{nntpd}->{pi_config}->{-by_newsgroup};
+        my $groups = $self->{nntpd}->{pi_cfg}->{-by_newsgroup};
         for my $ngname (@window) {
                 my $ibx = $groups->{$ngname} or next;
                 my $c = eval { $ibx->uidvalidity } // time;
@@ -165,7 +165,7 @@ sub list_active_times ($;$) { # called by cmd_list
 sub list_newsgroups_i {
         my ($self, $groupnames) = @_;
         my @window = splice(@$groupnames, 0, 100) or return 0;
-        my $groups = $self->{nntpd}->{pi_config}->{-by_newsgroup};
+        my $groups = $self->{nntpd}->{pi_cfg}->{-by_newsgroup};
         my $ibx;
         for my $ngname (@window) {
                 $ibx = $groups->{$ngname} and
@@ -268,7 +268,7 @@ sub group_line ($$) {
 sub newgroups_i {
         my ($self, $ts, $i, $groupnames) = @_;
         my $end = $$i + 100;
-        my $groups = $self->{nntpd}->{pi_config}->{-by_newsgroup};
+        my $groups = $self->{nntpd}->{pi_cfg}->{-by_newsgroup};
         while ($$i < $end) {
                 my $ngname = $groupnames->[$$i++] // return;
                 my $ibx = $groups->{$ngname} or next; # expired on reload
@@ -323,7 +323,7 @@ sub ngpat2re (;$) {
 sub newnews_i {
         my ($self, $names, $ts, $prev) = @_;
         my $ngname = $names->[0];
-        if (my $ibx = $self->{nntpd}->{pi_config}->{-by_newsgroup}->{$ngname}) {
+        if (my $ibx = $self->{nntpd}->{pi_cfg}->{-by_newsgroup}->{$ngname}) {
                 if (my $over = $ibx->over) {
                         my $msgs = $over->query_ts($ts, $$prev);
                         if (scalar @$msgs) {
@@ -362,7 +362,7 @@ sub cmd_newnews ($$$$;$$) {
 sub cmd_group ($$) {
         my ($self, $group) = @_;
         my $nntpd = $self->{nntpd};
-        my $ibx = $nntpd->{pi_config}->{-by_newsgroup}->{$group} or
+        my $ibx = $nntpd->{pi_cfg}->{-by_newsgroup}->{$group} or
                 return '411 no such news group';
         $nntpd->idler_start;
 
@@ -439,13 +439,13 @@ sub xref ($$$) {
         my $nntpd = $self->{nntpd};
         my $cur_ng = $cur_ibx->{newsgroup};
         my $xref;
-        if (my $ALL = $nntpd->{pi_config}->ALL) {
+        if (my $ALL = $nntpd->{pi_cfg}->ALL) {
                 $xref = $ALL->nntp_xref_for($cur_ibx, $smsg);
-                xref_by_tc($xref, $nntpd->{pi_config}, $smsg);
+                xref_by_tc($xref, $nntpd->{pi_cfg}, $smsg);
         } else { # slow path
                 $xref = { $cur_ng => $smsg->{num} };
                 my $mid = $smsg->{mid};
-                for my $ibx (values %{$nntpd->{pi_config}->{-by_newsgroup}}) {
+                for my $ibx (values %{$nntpd->{pi_cfg}->{-by_newsgroup}}) {
                         next if defined($xref->{$ibx->{newsgroup}});
                         my $num = eval { $ibx->mm->num_for($mid) } // next;
                         $xref->{$ibx->{newsgroup}} = $num;
@@ -733,7 +733,7 @@ sub mid_lookup ($$) {
                 my $n = $cur_ibx->mm->num_for($mid);
                 return ($cur_ibx, $n) if defined $n;
         }
-        my $pi_cfg = $self->{nntpd}->{pi_config};
+        my $pi_cfg = $self->{nntpd}->{pi_cfg};
         if (my $ALL = $pi_cfg->ALL) {
                 my ($id, $prev);
                 while (my $smsg = $ALL->over->next_by_mid($mid, \$id, \$prev)) {
@@ -1014,7 +1014,7 @@ sub cmd_xpath ($$) {
         return r501 unless $mid =~ $ONE_MSGID;
         $mid = $1;
         my @paths;
-        my $pi_cfg = $self->{nntpd}->{pi_config};
+        my $pi_cfg = $self->{nntpd}->{pi_cfg};
         my $groups = $pi_cfg->{-by_newsgroup};
         if (my $ALL = $pi_cfg->ALL) {
                 my ($id, $prev, %seen);
diff --git a/lib/PublicInbox/NNTPD.pm b/lib/PublicInbox/NNTPD.pm
index 03c56db3..953228d0 100644
--- a/lib/PublicInbox/NNTPD.pm
+++ b/lib/PublicInbox/NNTPD.pm
@@ -12,8 +12,8 @@ use PublicInbox::InboxIdle;
 
 sub new {
         my ($class) = @_;
-        my $pi_config = PublicInbox::Config->new;
-        my $name = $pi_config->{'publicinbox.nntpserver'};
+        my $pi_cfg = PublicInbox::Config->new;
+        my $name = $pi_cfg->{'publicinbox.nntpserver'};
         if (!defined($name) or $name eq '') {
                 $name = hostname;
         } elsif (ref($name) eq 'ARRAY') {
@@ -24,7 +24,7 @@ sub new {
                 groups => {},
                 err => \*STDERR,
                 out => \*STDOUT,
-                pi_config => $pi_config,
+                pi_cfg => $pi_cfg,
                 servername => $name,
                 greet => \"201 $name ready - post via email\r\n",
                 # accept_tls => { SSL_server => 1, ..., SSL_reuse_ctx => ... }
@@ -34,9 +34,9 @@ sub new {
 
 sub refresh_groups {
         my ($self, $sig) = @_;
-        my $pi_config = $sig ? PublicInbox::Config->new : $self->{pi_config};
-        my $groups = $pi_config->{-by_newsgroup}; # filled during each_inbox
-        $pi_config->each_inbox(sub {
+        my $pi_cfg = $sig ? PublicInbox::Config->new : $self->{pi_cfg};
+        my $groups = $pi_cfg->{-by_newsgroup}; # filled during each_inbox
+        $pi_cfg->each_inbox(sub {
                 my ($ibx) = @_;
                 my $ngname = $ibx->{newsgroup};
                 if (defined($ngname) && $ibx->nntp_usable) {
@@ -54,11 +54,11 @@ sub refresh_groups {
         });
         $self->{groupnames} = [ sort(keys %$groups) ];
         # this will destroy old groups that got deleted
-        $self->{pi_config} = $pi_config;
+        $self->{pi_cfg} = $pi_cfg;
 }
 
 sub idler_start {
-        $_[0]->{idler} //= PublicInbox::InboxIdle->new($_[0]->{pi_config});
+        $_[0]->{idler} //= PublicInbox::InboxIdle->new($_[0]->{pi_cfg});
 }
 
 1;
diff --git a/lib/PublicInbox/NewsWWW.pm b/lib/PublicInbox/NewsWWW.pm
index ade8dfd1..61d9ae7c 100644
--- a/lib/PublicInbox/NewsWWW.pm
+++ b/lib/PublicInbox/NewsWWW.pm
@@ -13,9 +13,8 @@ use PublicInbox::MID qw(mid_escape);
 use PublicInbox::Hval qw(prurl);
 
 sub new {
-        my ($class, $pi_config) = @_;
-        $pi_config ||= PublicInbox::Config->new;
-        bless { pi_config => $pi_config }, $class;
+        my ($class, $pi_cfg) = @_;
+        bless { pi_cfg => $pi_cfg // PublicInbox::Config->new }, $class;
 }
 
 sub redirect ($$) {
@@ -47,8 +46,8 @@ sub call {
         # /inbox.foo.bar/123456
         my (undef, @parts) = split(m!/!, $env->{PATH_INFO});
         my ($ng, $article) = @parts;
-        my $pi_config = $self->{pi_config};
-        if (my $ibx = $pi_config->lookup_newsgroup($ng)) {
+        my $pi_cfg = $self->{pi_cfg};
+        if (my $ibx = $pi_cfg->lookup_newsgroup($ng)) {
                 my $url = prurl($env, $ibx->{url});
                 my $code = 301;
                 if (defined $article && $article =~ /\A[0-9]+\z/) {
@@ -71,9 +70,9 @@ sub call {
                 pop @parts;
                 push @try, join('/', @parts);
         }
-        my $ALL = $pi_config->ALL;
+        my $ALL = $pi_cfg->ALL;
         if (my $over = $ALL ? $ALL->over : undef) {
-                my $by_eidx_key = $pi_config->{-by_eidx_key};
+                my $by_eidx_key = $pi_cfg->{-by_eidx_key};
                 for my $mid (@try) {
                         my ($id, $prev);
                         while (my $x = $over->next_by_mid($mid, \$id, \$prev)) {
@@ -90,7 +89,7 @@ sub call {
         } else { # slow path, scan every inbox
                 for my $mid (@try) {
                         my $arg = [ $mid ]; # [1] => result
-                        $pi_config->each_inbox(\&try_inbox, $arg);
+                        $pi_cfg->each_inbox(\&try_inbox, $arg);
                         return $arg->[1] if $arg->[1];
                 }
         }
diff --git a/lib/PublicInbox/Qspawn.pm b/lib/PublicInbox/Qspawn.pm
index 88b6d390..2aa2042a 100644
--- a/lib/PublicInbox/Qspawn.pm
+++ b/lib/PublicInbox/Qspawn.pm
@@ -359,12 +359,12 @@ sub new {
 }
 
 sub setup_rlimit {
-        my ($self, $name, $config) = @_;
+        my ($self, $name, $cfg) = @_;
         foreach my $rlim (@PublicInbox::Spawn::RLIMITS) {
                 my $k = lc($rlim);
                 $k =~ tr/_//d;
                 $k = "publicinboxlimiter.$name.$k";
-                defined(my $v = $config->{$k}) or next;
+                defined(my $v = $cfg->{$k}) or next;
                 my @rlimit = split(/\s*,\s*/, $v);
                 if (scalar(@rlimit) == 1) {
                         push @rlimit, $rlimit[0];
diff --git a/lib/PublicInbox/Spamcheck.pm b/lib/PublicInbox/Spamcheck.pm
index ffebb3cf..218fcc01 100644
--- a/lib/PublicInbox/Spamcheck.pm
+++ b/lib/PublicInbox/Spamcheck.pm
@@ -7,8 +7,8 @@ use strict;
 use warnings;
 
 sub get {
-        my ($config, $key, $default) = @_;
-        my $spamcheck = $config->{$key};
+        my ($cfg, $key, $default) = @_;
+        my $spamcheck = $cfg->{$key};
         $spamcheck = $default unless $spamcheck;
 
         return if !$spamcheck || $spamcheck eq 'none';
diff --git a/lib/PublicInbox/Unsubscribe.pm b/lib/PublicInbox/Unsubscribe.pm
index 945e7ae7..b0d3220c 100644
--- a/lib/PublicInbox/Unsubscribe.pm
+++ b/lib/PublicInbox/Unsubscribe.pm
@@ -39,7 +39,7 @@ sub new {
                 die "`unsubscribe' callback not given\n";
 
         bless {
-                pi_config => $opt{pi_config}, # PublicInbox::Config
+                pi_cfg => $opt{pi_config}, # PublicInbox::Config
                 owner_email => $opt{owner_email},
                 cipher => $cipher,
                 unsubscribe => $unsubscribe,
@@ -149,9 +149,9 @@ sub archive_info {
         my $archive_url = $self->{archive_urls}->{$list_addr};
 
         unless ($archive_url) {
-                if (my $config = $self->{pi_config}) {
+                if (my $cfg = $self->{pi_cfg}) {
                         # PublicInbox::Config::lookup
-                        my $ibx = $config->lookup($list_addr);
+                        my $ibx = $cfg->lookup($list_addr);
                         # PublicInbox::Inbox::base_url
                         $archive_url = $ibx->base_url if $ibx;
                 }
diff --git a/lib/PublicInbox/WWW.pm b/lib/PublicInbox/WWW.pm
index 6bae2190..a33d25ab 100644
--- a/lib/PublicInbox/WWW.pm
+++ b/lib/PublicInbox/WWW.pm
@@ -32,9 +32,8 @@ our $ATTACH_RE = qr!([0-9][0-9\.]*)-($PublicInbox::Hval::FN)!;
 our $OID_RE = qr![a-f0-9]{7,}!;
 
 sub new {
-        my ($class, $pi_config) = @_;
-        $pi_config ||= PublicInbox::Config->new;
-        bless { pi_config => $pi_config }, $class;
+        my ($class, $pi_cfg) = @_;
+        bless { pi_cfg => $pi_cfg // PublicInbox::Config->new }, $class;
 }
 
 # backwards compatibility, do not use
@@ -169,14 +168,14 @@ sub preload {
                 eval "require PublicInbox::$_;";
         }
         if (ref($self)) {
-                my $pi_config = $self->{pi_config};
-                if (defined($pi_config->{'publicinbox.cgitrc'})) {
-                        $pi_config->limiter('-cgit');
+                my $pi_cfg = $self->{pi_cfg};
+                if (defined($pi_cfg->{'publicinbox.cgitrc'})) {
+                        $pi_cfg->limiter('-cgit');
                 }
                 $self->cgit;
                 $self->stylesheets_prepare($_) for ('', '../', '../../');
                 $self->news_www;
-                $pi_config->each_inbox(\&preload_inbox);
+                $pi_cfg->each_inbox(\&preload_inbox);
         }
 }
 
@@ -210,8 +209,8 @@ sub news_cgit_fallback ($) {
 # returns undef if valid, array ref response if invalid
 sub invalid_inbox ($$) {
         my ($ctx, $inbox) = @_;
-        my $ibx = $ctx->{www}->{pi_config}->lookup_name($inbox) //
-                        $ctx->{www}->{pi_config}->lookup_ei($inbox);
+        my $ibx = $ctx->{www}->{pi_cfg}->lookup_name($inbox) //
+                        $ctx->{www}->{pi_cfg}->lookup_ei($inbox);
         if (defined $ibx) {
                 $ctx->{ibx} = $ibx;
                 return;
@@ -481,18 +480,18 @@ sub news_www {
         my ($self) = @_;
         $self->{news_www} ||= do {
                 require PublicInbox::NewsWWW;
-                PublicInbox::NewsWWW->new($self->{pi_config});
+                PublicInbox::NewsWWW->new($self->{pi_cfg});
         }
 }
 
 sub cgit {
         my ($self) = @_;
         $self->{cgit} ||= do {
-                my $pi_config = $self->{pi_config};
+                my $pi_cfg = $self->{pi_cfg};
 
-                if (defined($pi_config->{'publicinbox.cgitrc'})) {
+                if (defined($pi_cfg->{'publicinbox.cgitrc'})) {
                         require PublicInbox::Cgit;
-                        PublicInbox::Cgit->new($pi_config);
+                        PublicInbox::Cgit->new($pi_cfg);
                 } else {
                         require Plack::Util;
                         Plack::Util::inline_object(call => sub { r404() });
@@ -538,7 +537,7 @@ sub stylesheets_prepare ($$) {
         } || sub { $_[0] };
 
         my $css_map = {};
-        my $stylesheets = $self->{pi_config}->{css} || [];
+        my $stylesheets = $self->{pi_cfg}->{css} || [];
         my $links = [];
         my $inline_ok = 1;
 
diff --git a/lib/PublicInbox/Watch.pm b/lib/PublicInbox/Watch.pm
index 8bbce929..e1246096 100644
--- a/lib/PublicInbox/Watch.pm
+++ b/lib/PublicInbox/Watch.pm
@@ -41,7 +41,7 @@ sub compile_watchheaders ($) {
 }
 
 sub new {
-        my ($class, $config) = @_;
+        my ($class, $cfg) = @_;
         my (%mdmap, $spamc);
         my (%imap, %nntp); # url => [inbox objects] or 'watchspam'
 
@@ -50,7 +50,7 @@ sub new {
         # indefinitely...
         foreach my $pfx (qw(publicinboxwatch publicinboxlearn)) {
                 my $k = "$pfx.watchspam";
-                defined(my $dirs = $config->{$k}) or next;
+                defined(my $dirs = $cfg->{$k}) or next;
                 $dirs = PublicInbox::Config::_array($dirs);
                 for my $dir (@$dirs) {
                         my $url;
@@ -69,10 +69,10 @@ sub new {
 
         my $k = 'publicinboxwatch.spamcheck';
         my $default = undef;
-        my $spamcheck = PublicInbox::Spamcheck::get($config, $k, $default);
+        my $spamcheck = PublicInbox::Spamcheck::get($cfg, $k, $default);
         $spamcheck = _spamcheck_cb($spamcheck) if $spamcheck;
 
-        $config->each_inbox(sub {
+        $cfg->each_inbox(sub {
                 # need to make all inboxes writable for spam removal:
                 my $ibx = $_[0] = PublicInbox::InboxWritable->new($_[0]);
 
@@ -113,7 +113,7 @@ sub new {
                 spamcheck => $spamcheck,
                 mdmap => \%mdmap,
                 mdre => $mdre,
-                config => $config,
+                pi_cfg => $cfg,
                 imap => scalar keys %imap ? \%imap : undef,
                 nntp => scalar keys %nntp? \%nntp : undef,
                 importers => {},
@@ -175,7 +175,7 @@ sub _remove_spam {
         $path =~ /:2,[A-R]*S[T-Za-z]*\z/ or return;
         my $eml = eml_from_path($path) or return;
         local $SIG{__WARN__} = warn_ignore_cb();
-        $self->{config}->each_inbox(\&remove_eml_i, $self, $eml, $path);
+        $self->{pi_cfg}->each_inbox(\&remove_eml_i, $self, $eml, $path);
 }
 
 sub import_eml ($$$) {
@@ -316,7 +316,7 @@ sub cfg_bool ($$$) {
 # flesh out common IMAP-specific data structures
 sub imap_common_init ($) {
         my ($self) = @_;
-        my $cfg = $self->{config};
+        my $cfg = $self->{pi_cfg};
         my $mic_args = {}; # scheme://authority => Mail:IMAPClient arg
         for my $url (sort keys %{$self->{imap}}) {
                 my $uri = PublicInbox::URIimap->new($url);
@@ -418,7 +418,7 @@ sub imap_import_msg ($$$$$) {
                 if ($flags =~ /\\Seen\b/) {
                         local $SIG{__WARN__} = warn_ignore_cb();
                         my $eml = PublicInbox::Eml->new($raw);
-                        $self->{config}->each_inbox(\&remove_eml_i,
+                        $self->{pi_cfg}->each_inbox(\&remove_eml_i,
                                                 $self, $eml, "$url UID:$uid");
                 }
         } else {
@@ -775,7 +775,7 @@ sub watch_imap_init ($$) {
 # flesh out common NNTP-specific data structures
 sub nntp_common_init ($) {
         my ($self) = @_;
-        my $cfg = $self->{config};
+        my $cfg = $self->{pi_cfg};
         my $nn_args = {}; # scheme://authority => Net::NNTP->new arg
         for my $url (sort keys %{$self->{nntp}}) {
                 my $sec = uri_section(uri_new($url));
@@ -966,7 +966,7 @@ sub nntp_fetch_all ($$$) {
                         }
                 } elsif ($inboxes eq 'watchspam') {
                         my $eml = PublicInbox::Eml->new(\$raw);
-                        $self->{config}->each_inbox(\&remove_eml_i,
+                        $self->{pi_cfg}->each_inbox(\&remove_eml_i,
                                         $self, $eml, "$url ARTICLE $art");
                 } else {
                         die "BUG: destination unknown $inboxes";
diff --git a/lib/PublicInbox/WwwListing.pm b/lib/PublicInbox/WwwListing.pm
index bda2761c..fce0e530 100644
--- a/lib/PublicInbox/WwwListing.pm
+++ b/lib/PublicInbox/WwwListing.pm
@@ -44,7 +44,7 @@ sub url_regexp {
         my ($ctx, $key, $default) = @_;
         $key //= 'publicInbox.wwwListing';
         $default //= '404';
-        my $v = $ctx->{www}->{pi_config}->{lc $key} // $default;
+        my $v = $ctx->{www}->{pi_cfg}->{lc $key} // $default;
 again:
         if ($v eq 'match=domain') {
                 my $h = $ctx->{env}->{HTTP_HOST} // $ctx->{env}->{SERVER_NAME};
@@ -70,7 +70,7 @@ sub response {
         my ($class, $ctx) = @_;
         bless $ctx, $class;
         my $re = $ctx->url_regexp or return $ctx->psgi_triple;
-        my $iter = PublicInbox::ConfigIter->new($ctx->{www}->{pi_config},
+        my $iter = PublicInbox::ConfigIter->new($ctx->{www}->{pi_cfg},
                                                 \&list_match_i, $re, $ctx);
         sub {
                 $ctx->{-wcb} = $_[0]; # HTTP server callback
diff --git a/lib/PublicInbox/WwwStream.pm b/lib/PublicInbox/WwwStream.pm
index 849831a6..34e12435 100644
--- a/lib/PublicInbox/WwwStream.pm
+++ b/lib/PublicInbox/WwwStream.pm
@@ -81,7 +81,7 @@ sub coderepos ($) {
         my $ibx = $ctx->{ibx};
         my @ret;
         if (defined(my $cr = $ibx->{coderepo})) {
-                my $cfg = $ctx->{www}->{pi_config};
+                my $cfg = $ctx->{www}->{pi_cfg};
                 my $env = $ctx->{env};
                 for my $cr_name (@$cr) {
                         my $urls = $cfg->{"coderepo.$cr_name.cgiturl"};
diff --git a/lib/PublicInbox/WwwText.pm b/lib/PublicInbox/WwwText.pm
index 53e15e45..a8560916 100644
--- a/lib/PublicInbox/WwwText.pm
+++ b/lib/PublicInbox/WwwText.pm
@@ -189,9 +189,9 @@ EOF
 ; line number ranges in `[PATCH]' emails link to /$INBOX_NAME/$OID/s/,
 ; an HTTP endpoint which reconstructs git blobs via git-apply(1).
 EOF
-                my $pi_config = $ctx->{www}->{pi_config};
+                my $pi_cfg = $ctx->{www}->{pi_cfg};
                 for my $cr_name (@$cr) {
-                        my $urls = $pi_config->{"coderepo.$cr_name.cgiturl"};
+                        my $urls = $pi_cfg->{"coderepo.$cr_name.cgiturl"};
                         my $path = "/path/to/$cr_name";
                         $cr_name = dq_escape($cr_name);
 
diff --git a/script/public-inbox-learn b/script/public-inbox-learn
index fb2d86ec..9352c8ff 100755
--- a/script/public-inbox-learn
+++ b/script/public-inbox-learn
@@ -36,7 +36,7 @@ if ($train !~ /\A(?:ham|spam|rm)\z/) {
 die "--all only works with `rm'\n" if $opt{all} && $train ne 'rm';
 
 my $spamc = PublicInbox::Spamcheck::Spamc->new;
-my $pi_config = PublicInbox::Config->new;
+my $pi_cfg = PublicInbox::Config->new;
 my $err;
 my $mime = PublicInbox::Eml->new(do{
         local $/;
@@ -87,7 +87,7 @@ sub remove_or_add ($$$$) {
 
 # spam is removed from all known inboxes since it is often Bcc:-ed
 if ($train eq 'spam' || ($train eq 'rm' && $opt{all})) {
-        $pi_config->each_inbox(sub {
+        $pi_cfg->each_inbox(sub {
                 my ($ibx) = @_;
                 $ibx = PublicInbox::InboxWritable->new($ibx);
                 my $im = $ibx->importer(0);
@@ -102,7 +102,7 @@ if ($train eq 'spam' || ($train eq 'rm' && $opt{all})) {
         for ($mime->header('Cc'), $mime->header('To')) {
                 foreach my $addr (PublicInbox::Address::emails($_)) {
                         $addr = lc($addr);
-                        $dests{$addr} //= $pi_config->lookup($addr) // 0;
+                        $dests{$addr} //= $pi_cfg->lookup($addr) // 0;
                 }
         }
 
@@ -113,7 +113,7 @@ if ($train eq 'spam' || ($train eq 'rm' && $opt{all})) {
                 next if $seen{"$ibx"}++;
                 remove_or_add($ibx, $train, $mime, $addr);
         }
-        my $dests = PublicInbox::MDA->inboxes_for_list_id($pi_config, $mime);
+        my $dests = PublicInbox::MDA->inboxes_for_list_id($pi_cfg, $mime);
         for my $ibx (@$dests) {
                 next if $seen{"$ibx"}++;
                 remove_or_add($ibx, $train, $mime, $ibx->{-primary_address});
diff --git a/script/public-inbox-mda b/script/public-inbox-mda
index 3ed5abb6..40963f8e 100755
--- a/script/public-inbox-mda
+++ b/script/public-inbox-mda
@@ -42,18 +42,18 @@ my $str = do { local $/; <STDIN> };
 $str =~ s/\A[\r\n]*From [^\r\n]*\r?\n//s;
 $ems->prepare(\$str);
 my $eml = PublicInbox::Eml->new(\$str);
-my $config = PublicInbox::Config->new;
+my $cfg = PublicInbox::Config->new;
 my $key = 'publicinboxmda.spamcheck';
 my $default = 'PublicInbox::Spamcheck::Spamc';
-my $spamc = PublicInbox::Spamcheck::get($config, $key, $default);
+my $spamc = PublicInbox::Spamcheck::get($cfg, $key, $default);
 my $dests = [];
 my $recipient = $ENV{ORIGINAL_RECIPIENT};
 if (defined $recipient) {
-        my $ibx = $config->lookup($recipient); # first check
+        my $ibx = $cfg->lookup($recipient); # first check
         push @$dests, $ibx if $ibx;
 }
 if (!scalar(@$dests)) {
-        $dests = PublicInbox::MDA->inboxes_for_list_id($config, $eml);
+        $dests = PublicInbox::MDA->inboxes_for_list_id($cfg, $eml);
         if (!scalar(@$dests) && !defined($recipient)) {
                 die "ORIGINAL_RECIPIENT not defined in ENV\n";
         }
diff --git a/scripts/import_slrnspool b/scripts/import_slrnspool
index bdcc605c..0acffc1f 100755
--- a/scripts/import_slrnspool
+++ b/scripts/import_slrnspool
@@ -22,8 +22,8 @@ $SIG{TERM} = $sighandler;
 my $spool = shift @ARGV or die usage();
 my $recipient = $ENV{ORIGINAL_RECIPIENT};
 defined $recipient or die usage();
-my $config = PublicInbox::Config->new;
-my $ibx = $config->lookup($recipient);
+my $cfg = PublicInbox::Config->new;
+my $ibx = $cfg->lookup($recipient);
 my $git = $ibx->git;
 my $im;
 if ($ibx->version == 2) {
diff --git a/t/imapd.t b/t/imapd.t
index c1c52839..43ec200c 100644
--- a/t/imapd.t
+++ b/t/imapd.t
@@ -251,8 +251,8 @@ ok($mic->logout, 'logout works');
 
 my $have_inotify = eval { require Linux::Inotify2; 1 };
 
-my $pi_config = PublicInbox::Config->new;
-$pi_config->each_inbox(sub {
+my $pi_cfg = PublicInbox::Config->new;
+$pi_cfg->each_inbox(sub {
         my ($ibx) = @_;
         my $env = { ORIGINAL_RECIPIENT => $ibx->{-primary_address} };
         my $name = $ibx->{name};
diff --git a/t/inbox_idle.t b/t/inbox_idle.t
index e16ee11b..198856bd 100644
--- a/t/inbox_idle.t
+++ b/t/inbox_idle.t
@@ -32,14 +32,14 @@ for my $V (1, 2) {
                 $sidx->set_metadata_once;
                 $sidx->idx_release; # allow watching on lockfile
         }
-        my $pi_config = PublicInbox::Config->new(\<<EOF);
+        my $pi_cfg = PublicInbox::Config->new(\<<EOF);
 publicinbox.inbox-idle.inboxdir=$inboxdir
 publicinbox.inbox-idle.indexlevel=basic
 publicinbox.inbox-idle.address=test\@example.com
 EOF
         my $ident = 'whatever';
-        $pi_config->each_inbox(sub { shift->subscribe_unlock($ident, $obj) });
-        my $ii = PublicInbox::InboxIdle->new($pi_config);
+        $pi_cfg->each_inbox(sub { shift->subscribe_unlock($ident, $obj) });
+        my $ii = PublicInbox::InboxIdle->new($pi_cfg);
         ok($ii, 'InboxIdle created');
         SKIP: {
                 skip('inotify or kqueue missing', 1) unless $ii->{sock};
@@ -50,7 +50,7 @@ EOF
         PublicInbox::SearchIdx->new($ibx)->index_sync if $V == 1;
         $ii->event_step;
         is(scalar @{$obj->{called}}, 1, 'called on unlock');
-        $pi_config->each_inbox(sub { shift->unsubscribe_unlock($ident) });
+        $pi_cfg->each_inbox(sub { shift->unsubscribe_unlock($ident) });
         ok($im->add(eml_load('t/data/0001.patch')), "$V added #2");
         $im->done;
         PublicInbox::SearchIdx->new($ibx)->index_sync if $V == 1;
diff --git a/t/mda_filter_rubylang.t b/t/mda_filter_rubylang.t
index 754d52f7..489ea223 100644
--- a/t/mda_filter_rubylang.t
+++ b/t/mda_filter_rubylang.t
@@ -44,8 +44,8 @@ something
 EOF
                 ok(run_script(['-mda'], $env, $opt), 'message delivered');
         }
-        my $config = PublicInbox::Config->new;
-        my $ibx = $config->lookup_name($v);
+        my $cfg = PublicInbox::Config->new;
+        my $ibx = $cfg->lookup_name($v);
 
         # make sure all serials are searchable:
         for my $i (1..2) {
diff --git a/t/nntp.t b/t/nntp.t
index 3d2f524c..b745886d 100644
--- a/t/nntp.t
+++ b/t/nntp.t
@@ -113,7 +113,7 @@ use PublicInbox::Config;
         my $mock_self = {
                 nntpd => {
                         servername => 'example.com',
-                        pi_config => bless {}, 'PublicInbox::Config',
+                        pi_cfg => bless {}, 'PublicInbox::Config',
                 },
                 ibx => $ibx,
         };
diff --git a/t/psgi_mount.t b/t/psgi_mount.t
index b4de8274..dac62c1a 100644
--- a/t/psgi_mount.t
+++ b/t/psgi_mount.t
@@ -17,7 +17,7 @@ use_ok 'PublicInbox::WWW';
 use PublicInbox::Import;
 use PublicInbox::Git;
 use PublicInbox::Config;
-my $config = PublicInbox::Config->new(\<<EOF);
+my $cfg = PublicInbox::Config->new(\<<EOF);
 $cfgpfx.address=$addr
 $cfgpfx.inboxdir=$maindir
 EOF
@@ -39,7 +39,7 @@ EOF
         $im->done;
 }
 
-my $www = PublicInbox::WWW->new($config);
+my $www = PublicInbox::WWW->new($cfg);
 my $app = builder(sub {
         enable('Head');
         mount('/a' => builder(sub { sub { $www->call(@_) } }));
@@ -85,7 +85,7 @@ test_psgi($app, sub {
 
 SKIP: {
         require_mods(qw(DBD::SQLite Search::Xapian IO::Uncompress::Gunzip), 3);
-        my $ibx = $config->lookup_name('test');
+        my $ibx = $cfg->lookup_name('test');
         require_ok 'PublicInbox::SearchIdx';
         PublicInbox::SearchIdx->new($ibx, 1)->index_sync;
         test_psgi($app, sub {
diff --git a/t/psgi_search.t b/t/psgi_search.t
index c1677eb3..07fb4846 100644
--- a/t/psgi_search.t
+++ b/t/psgi_search.t
@@ -67,11 +67,11 @@ $im->done;
 PublicInbox::SearchIdx->new($ibx, 1)->index_sync;
 
 my $cfgpfx = "publicinbox.test";
-my $config = PublicInbox::Config->new(\<<EOF);
+my $cfg = PublicInbox::Config->new(\<<EOF);
 $cfgpfx.address=git\@vger.kernel.org
 $cfgpfx.inboxdir=$tmpdir
 EOF
-my $www = PublicInbox::WWW->new($config);
+my $www = PublicInbox::WWW->new($cfg);
 test_psgi(sub { $www->call(@_) }, sub {
         my ($cb) = @_;
         my $res;
@@ -144,7 +144,7 @@ test_psgi(sub { $www->call(@_) }, sub {
                 $xdb->set_metadata('has_threadid', '0');
                 $sidx->idx_release;
         }
-        $config->each_inbox(sub { delete $_[0]->{search} });
+        $cfg->each_inbox(sub { delete $_[0]->{search} });
         $res = $cb->(GET('/test/?q=s:test'));
         is($res->code, 200, 'successful search w/o has_threadid');
         unlike($html, qr/download mbox\.gz: .*?"full threads"/s,
diff --git a/t/psgi_v2.t b/t/psgi_v2.t
index 11aef5b3..0ceb26ed 100644
--- a/t/psgi_v2.t
+++ b/t/psgi_v2.t
@@ -83,12 +83,11 @@ like($$msg, qr/\AFrom oldbug/s,
         '"From_" line stored to test old bug workaround');
 
 my $cfgpfx = "publicinbox.v2test";
-my $cfg = <<EOF;
+my $cfg = PublicInbox::Config->new(\<<EOF);
 $cfgpfx.address=$ibx->{-primary_address}
 $cfgpfx.inboxdir=$inboxdir
 EOF
-my $config = PublicInbox::Config->new(\$cfg);
-my $www = PublicInbox::WWW->new($config);
+my $www = PublicInbox::WWW->new($cfg);
 my ($res, $raw, @from_);
 my $client0 = sub {
         my ($cb) = @_;
@@ -150,7 +149,7 @@ my $client1 = sub {
         like($raw, qr/^hello ghosts$/m, 'got third message');
         @from_ = ($raw =~ m/^From /mg);
         is(scalar(@from_), 3, 'three From_ lines');
-        $config->each_inbox(sub { $_[0]->search->reopen });
+        $cfg->each_inbox(sub { $_[0]->search->reopen });
 
         SKIP: {
                 eval { require IO::Uncompress::Gunzip };
@@ -240,7 +239,7 @@ $run_httpd->($client1, 38);
         $im->done;
         my @h = $mime->header('Message-ID');
         is_deeply($exp, \@h, 'reused existing Message-ID');
-        $config->each_inbox(sub { $_[0]->search->reopen });
+        $cfg->each_inbox(sub { $_[0]->search->reopen });
 }
 
 my $client2 = sub {
@@ -279,7 +278,7 @@ $run_httpd->($client2, 8);
                 ok($im->add($mime), "added attachment $body");
         }
         $im->done;
-        $config->each_inbox(sub { $_[0]->search->reopen });
+        $cfg->each_inbox(sub { $_[0]->search->reopen });
 }
 
 my $client3 = sub {
diff --git a/t/watch_filter_rubylang.t b/t/watch_filter_rubylang.t
index 6513f30b..9c70b4ea 100644
--- a/t/watch_filter_rubylang.t
+++ b/t/watch_filter_rubylang.t
@@ -72,11 +72,11 @@ $cfgpfx.filter=PublicInbox::Filter::RubyLang
 $cfgpfx.altid=serial:alerts:file=msgmap.sqlite3
 publicinboxwatch.watchspam=maildir:$spamdir
 EOF
-        my $config = PublicInbox::Config->new(\$orig);
-        my $ibx = $config->lookup_name($v);
+        my $cfg = PublicInbox::Config->new(\$orig);
+        my $ibx = $cfg->lookup_name($v);
         ok($ibx, 'found inbox by name');
 
-        my $w = PublicInbox::Watch->new($config);
+        my $w = PublicInbox::Watch->new($cfg);
         for my $i (1..2) {
                 $w->scan('full');
         }
@@ -101,8 +101,8 @@ EOF
         }
         $w->scan('full');
 
-        $config = PublicInbox::Config->new(\$orig);
-        $ibx = $config->lookup_name($v);
+        $cfg = PublicInbox::Config->new(\$orig);
+        $ibx = $cfg->lookup_name($v);
         is($ibx->search->reopen->mset('b:spam')->size, 0, 'spam removed');
 
         is_deeply([], \@warn, 'no warnings');
diff --git a/t/watch_maildir.t b/t/watch_maildir.t
index ae53caf9..c948b41b 100644
--- a/t/watch_maildir.t
+++ b/t/watch_maildir.t
@@ -34,13 +34,13 @@ my $sem = PublicInbox::Emergency->new($spamdir); # create dirs
 {
         my @w;
         local $SIG{__WARN__} = sub { push @w, @_ };
-        my $config = PublicInbox::Config->new(\<<EOF);
+        my $cfg = PublicInbox::Config->new(\<<EOF);
 $cfgpfx.address=$addr
 $cfgpfx.inboxdir=$git_dir
 $cfgpfx.watch=maildir:$spamdir
 publicinboxlearn.watchspam=maildir:$spamdir
 EOF
-        my $wm = PublicInbox::Watch->new($config);
+        my $wm = PublicInbox::Watch->new($cfg);
         is(scalar grep(/is a spam folder/, @w), 1, 'got warning about spam');
         is_deeply($wm->{mdmap}, { "$spamdir/cur" => 'watchspam' },
                 'only got the spam folder to watch');
@@ -61,8 +61,8 @@ EOF
         close $fh or BAIL_OUT $!;
 }
 
-my $config = PublicInbox::Config->new($cfg_path);
-PublicInbox::Watch->new($config)->scan('full');
+my $cfg = PublicInbox::Config->new($cfg_path);
+PublicInbox::Watch->new($cfg)->scan('full');
 my $git = PublicInbox::Git->new($git_dir);
 my @list = $git->qx(qw(rev-list refs/heads/master));
 is(scalar @list, 1, 'one revision in rev-list');
@@ -79,7 +79,7 @@ my $write_spam = sub {
 };
 $write_spam->();
 is(unlink(glob("$maildir/new/*")), 1, 'unlinked old spam');
-PublicInbox::Watch->new($config)->scan('full');
+PublicInbox::Watch->new($cfg)->scan('full');
 @list = $git->qx(qw(rev-list refs/heads/master));
 is(scalar @list, 2, 'two revisions in rev-list');
 @list = $git->qx(qw(ls-tree -r --name-only refs/heads/master));
@@ -93,7 +93,7 @@ To unsubscribe from this list: send the line "unsubscribe git" in
 the body of a message to majordomo\@vger.kernel.org
 More majordomo info at  http://vger.kernel.org/majordomo-info.html\n);
         PublicInbox::Emergency->new($maildir)->prepare(\$msg);
-        PublicInbox::Watch->new($config)->scan('full');
+        PublicInbox::Watch->new($cfg)->scan('full');
         @list = $git->qx(qw(ls-tree -r --name-only refs/heads/master));
         is(scalar @list, 1, 'tree has one file');
         my $mref = $git->cat_file('HEAD:'.$list[0]);
@@ -101,7 +101,7 @@ More majordomo info at  http://vger.kernel.org/majordomo-info.html\n);
 
         is(unlink(glob("$maildir/new/*")), 1, 'unlinked spam');
         $write_spam->();
-        PublicInbox::Watch->new($config)->scan('full');
+        PublicInbox::Watch->new($cfg)->scan('full');
         @list = $git->qx(qw(ls-tree -r --name-only refs/heads/master));
         is(scalar @list, 0, 'tree is empty');
         @list = $git->qx(qw(rev-list refs/heads/master));
@@ -115,10 +115,10 @@ More majordomo info at  http://vger.kernel.org/majordomo-info.html\n);
         my $fail_path = "$fail_bin:$ENV{PATH}"; # for spamc ham mock
         local $ENV{PATH} = $fail_path;
         PublicInbox::Emergency->new($maildir)->prepare(\$msg);
-        $config->{'publicinboxwatch.spamcheck'} = 'spamc';
+        $cfg->{'publicinboxwatch.spamcheck'} = 'spamc';
         {
                 local $SIG{__WARN__} = sub {}; # quiet spam check warning
-                PublicInbox::Watch->new($config)->scan('full');
+                PublicInbox::Watch->new($cfg)->scan('full');
         }
         @list = $git->qx(qw(ls-tree -r --name-only refs/heads/master));
         is(scalar @list, 0, 'tree has no files spamc checked');
@@ -131,9 +131,9 @@ More majordomo info at  http://vger.kernel.org/majordomo-info.html\n);
         my $main_path = "$main_bin:$ENV{PATH}"; # for spamc ham mock
         local $ENV{PATH} = $main_path;
         PublicInbox::Emergency->new($maildir)->prepare(\$msg);
-        $config->{'publicinboxwatch.spamcheck'} = 'spamc';
+        $cfg->{'publicinboxwatch.spamcheck'} = 'spamc';
         @list = $git->qx(qw(ls-tree -r --name-only refs/heads/master));
-        PublicInbox::Watch->new($config)->scan('full');
+        PublicInbox::Watch->new($cfg)->scan('full');
         @list = $git->qx(qw(ls-tree -r --name-only refs/heads/master));
         is(scalar @list, 1, 'tree has one file after spamc checked');
 
@@ -166,9 +166,9 @@ More majordomo info at  http://vger.kernel.org/majordomo-info.html\n);
                 $delivered++;
         };
         PublicInbox::DS->Reset;
-        my $ii = PublicInbox::InboxIdle->new($config);
+        my $ii = PublicInbox::InboxIdle->new($cfg);
         my $obj = bless \$cb, 'PublicInbox::TestCommon::InboxWakeup';
-        $config->each_inbox(sub { $_[0]->subscribe_unlock('ident', $obj) });
+        $cfg->each_inbox(sub { $_[0]->subscribe_unlock('ident', $obj) });
         PublicInbox::DS->SetPostLoopCallback(sub { $delivered == 0 });
 
         # wait for -watch to setup inotify watches
diff --git a/t/watch_maildir_v2.t b/t/watch_maildir_v2.t
index 12546418..532e5c7c 100644
--- a/t/watch_maildir_v2.t
+++ b/t/watch_maildir_v2.t
@@ -44,11 +44,11 @@ $cfgpfx.watch=maildir:$maildir
 $cfgpfx.filter=PublicInbox::Filter::Vger
 publicinboxlearn.watchspam=maildir:$spamdir
 EOF
-my $config = PublicInbox::Config->new(\$orig);
-my $ibx = $config->lookup_name('test');
+my $cfg = PublicInbox::Config->new(\$orig);
+my $ibx = $cfg->lookup_name('test');
 ok($ibx, 'found inbox by name');
 
-PublicInbox::Watch->new($config)->scan('full');
+PublicInbox::Watch->new($cfg)->scan('full');
 my $total = scalar @{$ibx->over->recent};
 is($total, 1, 'got one revision');
 
@@ -68,7 +68,7 @@ my $write_spam = sub {
 };
 $write_spam->();
 is(unlink(glob("$maildir/new/*")), 1, 'unlinked old spam');
-PublicInbox::Watch->new($config)->scan('full');
+PublicInbox::Watch->new($cfg)->scan('full');
 is_deeply($ibx->over->recent, [], 'deleted file');
 is(unlink(glob("$spamdir/cur/*")), 1, 'unlinked trained spam');
 
@@ -79,7 +79,7 @@ To unsubscribe from this list: send the line "unsubscribe git" in
 the body of a message to majordomo\@vger.kernel.org
 More majordomo info at  http://vger.kernel.org/majordomo-info.html\n);
         PublicInbox::Emergency->new($maildir)->prepare(\$msg);
-        PublicInbox::Watch->new($config)->scan('full');
+        PublicInbox::Watch->new($cfg)->scan('full');
         my $msgs = $ibx->over->recent;
         is(scalar(@$msgs), 1, 'got one file back');
         my $mref = $ibx->msg_by_smsg($msgs->[0]);
@@ -87,7 +87,7 @@ More majordomo info at  http://vger.kernel.org/majordomo-info.html\n);
 
         is(unlink(glob("$maildir/new/*")), 1, 'unlinked spam');
         $write_spam->();
-        PublicInbox::Watch->new($config)->scan('full');
+        PublicInbox::Watch->new($cfg)->scan('full');
         $msgs = $ibx->over->recent;
         is(scalar(@$msgs), 0, 'inbox is empty again');
         is(unlink(glob("$spamdir/cur/*")), 1, 'unlinked trained spam');
@@ -99,10 +99,10 @@ More majordomo info at  http://vger.kernel.org/majordomo-info.html\n);
         my $fail_path = "$fail_bin:$ENV{PATH}"; # for spamc ham mock
         local $ENV{PATH} = $fail_path;
         PublicInbox::Emergency->new($maildir)->prepare(\$msg);
-        $config->{'publicinboxwatch.spamcheck'} = 'spamc';
+        $cfg->{'publicinboxwatch.spamcheck'} = 'spamc';
         {
                 local $SIG{__WARN__} = sub {}; # quiet spam check warning
-                PublicInbox::Watch->new($config)->scan('full');
+                PublicInbox::Watch->new($cfg)->scan('full');
         }
         my $msgs = $ibx->over->recent;
         is(scalar(@$msgs), 0, 'inbox is still empty');
@@ -115,13 +115,13 @@ More majordomo info at  http://vger.kernel.org/majordomo-info.html\n);
         my $main_path = "$main_bin:$ENV{PATH}"; # for spamc ham mock
         local $ENV{PATH} = $main_path;
         PublicInbox::Emergency->new($maildir)->prepare(\$msg);
-        $config->{'publicinboxwatch.spamcheck'} = 'spamc';
-        PublicInbox::Watch->new($config)->scan('full');
+        $cfg->{'publicinboxwatch.spamcheck'} = 'spamc';
+        PublicInbox::Watch->new($cfg)->scan('full');
         my $msgs = $ibx->over->recent;
         is(scalar(@$msgs), 1, 'inbox has one mail after spamc OK-ed a message');
         my $mref = $ibx->msg_by_smsg($msgs->[0]);
         like($$mref, qr/something\n\z/s, 'message scrubbed on import');
-        delete $config->{'publicinboxwatch.spamcheck'};
+        delete $cfg->{'publicinboxwatch.spamcheck'};
 }
 
 {
@@ -129,7 +129,7 @@ More majordomo info at  http://vger.kernel.org/majordomo-info.html\n);
         open my $fh, '<', $patch or die "failed to open $patch: $!\n";
         $msg = do { local $/; <$fh> };
         PublicInbox::Emergency->new($maildir)->prepare(\$msg);
-        PublicInbox::Watch->new($config)->scan('full');
+        PublicInbox::Watch->new($cfg)->scan('full');
         my $post = $ibx->search->reopen->mset('dfpost:6e006fd7');
         is($post->size, 1, 'diff postimage found');
         my $pre = $ibx->search->mset('dfpre:090d998b6c2c');
@@ -146,12 +146,12 @@ More majordomo info at  http://vger.kernel.org/majordomo-info.html\n);
         my $v1pfx = "publicinbox.v1";
         my $v1addr = 'v1-public@example.com';
         PublicInbox::Import::init_bare($v1repo);
-        my $cfg2 = <<EOF;
+        my $raw = <<EOF;
 $orig$v1pfx.address=$v1addr
 $v1pfx.inboxdir=$v1repo
 $v1pfx.watch=maildir:$maildir
 EOF
-        my $config = PublicInbox::Config->new(\$cfg2);
+        my $cfg = PublicInbox::Config->new(\$raw);
         my $both = <<EOF;
 From: user\@example.com
 To: $addr, $v1addr
@@ -162,10 +162,10 @@ Date: Sat, 18 Jun 2016 00:00:00 +0000
 both
 EOF
         PublicInbox::Emergency->new($maildir)->prepare(\$both);
-        PublicInbox::Watch->new($config)->scan('full');
+        PublicInbox::Watch->new($cfg)->scan('full');
         my $mset = $ibx->search->reopen->mset('m:both@b.com');
         my $msgs = $ibx->search->mset_to_smsg($ibx, $mset);
-        my $v1 = $config->lookup_name('v1');
+        my $v1 = $cfg->lookup_name('v1');
         my $msg = $v1->git->cat_file($msgs->[0]->{blob});
         is($both, $$msg, 'got original message back from v1');
         $msg = $ibx->git->cat_file($msgs->[0]->{blob});
@@ -184,21 +184,21 @@ List-Id: <do.not.want>
 X-Mailing-List: no@example.com
 Message-ID: <do.not.want@example.com>
 EOF
-        my $cfg = $orig."$cfgpfx.listid=i.want.you.to.want.me\n";
+        my $raw = $orig."$cfgpfx.listid=i.want.you.to.want.me\n";
         PublicInbox::Emergency->new($maildir)->prepare(\$want);
         PublicInbox::Emergency->new($maildir)->prepare(\$do_not_want);
-        my $config = PublicInbox::Config->new(\$cfg);
-        PublicInbox::Watch->new($config)->scan('full');
-        $ibx = $config->lookup_name('test');
+        my $cfg = PublicInbox::Config->new(\$raw);
+        PublicInbox::Watch->new($cfg)->scan('full');
+        $ibx = $cfg->lookup_name('test');
         my $num = $ibx->mm->num_for('do.want@example.com');
         ok(defined $num, 'List-ID matched for watch');
         $num = $ibx->mm->num_for('do.not.want@example.com');
         is($num, undef, 'unaccepted List-ID matched for watch');
 
-        $cfg = $orig."$cfgpfx.watchheader=X-Mailing-List:no\@example.com\n";
-        $config = PublicInbox::Config->new(\$cfg);
-        PublicInbox::Watch->new($config)->scan('full');
-        $ibx = $config->lookup_name('test');
+        $raw = $orig."$cfgpfx.watchheader=X-Mailing-List:no\@example.com\n";
+        $cfg = PublicInbox::Config->new(\$raw);
+        PublicInbox::Watch->new($cfg)->scan('full');
+        $ibx = $cfg->lookup_name('test');
         $num = $ibx->mm->num_for('do.not.want@example.com');
         ok(defined $num, 'X-Mailing-List matched');
 }
diff --git a/t/watch_multiple_headers.t b/t/watch_multiple_headers.t
index a0813532..1fe392d4 100644
--- a/t/watch_multiple_headers.t
+++ b/t/watch_multiple_headers.t
@@ -54,16 +54,16 @@ PublicInbox::Emergency->new($maildir)->prepare(\$msg_to);
 PublicInbox::Emergency->new($maildir)->prepare(\$msg_cc);
 PublicInbox::Emergency->new($maildir)->prepare(\$msg_none);
 
-my $cfg = <<EOF;
+my $raw = <<EOF;
 $cfgpfx.address=$addr
 $cfgpfx.inboxdir=$inboxdir
 $cfgpfx.watch=maildir:$maildir
 $cfgpfx.watchheader=To:$addr
 $cfgpfx.watchheader=Cc:$addr
 EOF
-my $config = PublicInbox::Config->new(\$cfg);
-PublicInbox::Watch->new($config)->scan('full');
-my $ibx = $config->lookup_name('test');
+my $cfg = PublicInbox::Config->new(\$raw);
+PublicInbox::Watch->new($cfg)->scan('full');
+my $ibx = $cfg->lookup_name('test');
 ok($ibx, 'found inbox by name');
 
 my $num = $ibx->mm->num_for('to@a.com');