From: Eric Wong <e@yhbt.net>
To: meta@public-inbox.org
Subject: [PATCH 2/3] wwwtext: show altid instructions in config
Date: Thu, 26 Mar 2020 08:21:28 +0000 [thread overview]
Message-ID: <20200326082129.21699-3-e@yhbt.net> (raw)
In-Reply-To: <20200326082129.21699-1-e@yhbt.net>
Exposing altid dumps will help and ensure total reproducibility
of existing instances.
AFAIK, sqlite3(1) can't execute arbitrary code, so it's not
quite as fashionable as the "curl | bash" stuff the cool people
are doing, these days :P
---
lib/PublicInbox/WwwText.pm | 20 ++++++++++++++++++--
1 file changed, 18 insertions(+), 2 deletions(-)
diff --git a/lib/PublicInbox/WwwText.pm b/lib/PublicInbox/WwwText.pm
index cbe82b73..2008ba09 100644
--- a/lib/PublicInbox/WwwText.pm
+++ b/lib/PublicInbox/WwwText.pm
@@ -138,15 +138,16 @@ sub inbox_config ($$$) {
my $ibx = $ctx->{-inbox};
push @$hdr, 'Content-Disposition', 'inline; filename=inbox.config';
my $name = dq_escape($ibx->{name});
+ my $inboxdir = '/path/to/top-level-inbox';
$$txt .= <<EOS;
; example public-inbox config snippet for "$name"
; see public-inbox-config(5) manpage for more details:
; https://public-inbox.org/public-inbox-config.html
[publicinbox "$name"]
- inboxdir = /path/to/top-level-inbox
+ inboxdir = $inboxdir
; note: public-inbox before v1.2.0 used "mainrepo"
; instead of "inboxdir", both remain supported after 1.2
- mainrepo = /path/to/top-level-inbox
+ mainrepo = $inboxdir
url = https://example.com/$name/
url = http://example.onion/$name/
EOS
@@ -154,6 +155,21 @@ EOS
defined(my $v = $ibx->{$k}) or next;
$$txt .= "\t$k = $_\n" for @$v;
}
+ if (my $altid = $ibx->{altid}) {
+ my $base_url = $ibx->base_url($ctx->{env});
+ my $altid_map = $ibx->altid_map;
+ $$txt .= <<EOF;
+ ; altid DBs may be used to provide numeric article ID lookup from
+ ; old, pre-existing sources. You can recreate them via curl(1),
+ ; gzip(1), and sqlite3(1) as documented:
+EOF
+ for (sort keys %$altid_map) {
+ $$txt .= "\t;\tcurl -XPOST $base_url$_.sql.gz | \\\n" .
+ "\t;\tgzip -dc | \\\n" .
+ "\t;\tsqlite3 $inboxdir/$_.sqlite3\n";
+ $$txt .= "\taltid = serial:$_:file=$_.sqlite3\n";
+ }
+ }
for my $k (qw(filter newsgroup obfuscate replyto watchheader)) {
defined(my $v = $ibx->{$k}) or next;
next prev parent reply other threads:[~2020-03-26 8:21 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-03-26 8:21 [PATCH 0/3] wwwaltid: add pointers for usability Eric Wong
2020-03-26 8:21 ` [PATCH 1/3] inbox: altid_map becomes a method Eric Wong
2020-03-26 8:21 ` Eric Wong [this message]
2020-03-26 8:21 ` [PATCH 3/3] wwwaltid: inform users to use POST instead of GET Eric Wong
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
List information: http://public-inbox.org/README
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20200326082129.21699-3-e@yhbt.net \
--to=e@yhbt.net \
--cc=meta@public-inbox.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
Code repositories for project(s) associated with this public inbox
https://80x24.org/public-inbox.git
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).