user/dev discussion of public-inbox itself
 help / color / mirror / code / Atom feed
Search results ordered by [date|relevance]  view[summary|nested|Atom feed]
thread overview below | download mbox.gz: |
* [PATCH v2 3/4] public-inbox-init: Initialize indexlevel
  @ 2018-07-18 17:32  7%           ` Eric W. Biederman
  0 siblings, 0 replies; 1+ results
From: Eric W. Biederman @ 2018-07-18 17:32 UTC (permalink / raw)
  To: Eric Wong; +Cc: meta


If indexlevel is specified on the command line prefer that.
If indexlevel is specified in the config file prefer that.
If indexlevel is not specified anywhere default to full.

This should make indexlevel somewhat approachable.

Signed-off-by: "Eric W. Biederman" <ebiederm@xmission.com>
---

I believe this is the other piece of the user interface needed
to make indexlevel accessible.

 script/public-inbox-init | 14 +++++++++++++-
 1 file changed, 13 insertions(+), 1 deletion(-)

diff --git a/script/public-inbox-init b/script/public-inbox-init
index 3ef6c3bdba2d..5e961c803203 100755
--- a/script/public-inbox-init
+++ b/script/public-inbox-init
@@ -16,7 +16,10 @@ use Cwd qw/abs_path/;
 sub x { system(@_) and die join(' ', @_). " failed: $?\n" }
 sub usage { print STDERR "Usage: $usage\n"; exit 1 }
 my $version = undef;
-my %opts = ( 'V|version=i' => \$version );
+my $indexlevel = undef;
+my %opts = ( 'V|version=i' => \$version,
+	     'L|indexlevel=s' => \$indexlevel,
+);
 GetOptions(%opts) or usage();
 my $name = shift @ARGV or usage();
 my $mainrepo = shift @ARGV or usage();
@@ -64,8 +67,16 @@ if (-e $pi_config) {
 	}
 
 	exit(1) if $conflict;
+
+	my $ibx = $cfg->lookup_name($name);
+	if ($ibx) {
+		if (!defined($indexlevel) && $ibx->{indexlevel}) {
+			$indexlevel = $ibx->{indexlevel};
+		}
+	}
 }
 close $fh or die "failed to close $pi_config_tmp: $!\n";
+$indexlevel ||= 'full';
 
 my $pfx = "publicinbox.$name";
 my @x = (qw/git config/, "--file=$pi_config_tmp");
@@ -114,6 +125,7 @@ foreach my $addr (@address) {
 }
 x(@x, "$pfx.url", $http_url);
 x(@x, "$pfx.mainrepo", $mainrepo);
+x(@x, "$pfx.indexlevel", $indexlevel);
 
 rename $pi_config_tmp, $pi_config or
 	die "failed to rename `$pi_config_tmp' to `$pi_config': $!\n";
-- 
2.17.1


^ permalink raw reply related	[relevance 7%]

Results 1-1 of 1 | reverse | options above
-- pct% links below jump to the message on this page, permalinks otherwise --
2018-07-17 23:27     [PATCH 0/3] Making the search indexes optional Eric W. Biederman
2018-07-17 23:30     ` [PATCH 3/3] SearchIdx: Allow the amount of indexing be configured Eric W. Biederman
2018-07-18 10:22       ` Eric Wong
2018-07-18 16:00         ` Eric W. Biederman
2018-07-18 16:31           ` Eric Wong
2018-07-18 16:52             ` [PATCH v2 1/3] Making the search indexes optional Eric W. Biederman
2018-07-18 17:32  7%           ` [PATCH v2 3/4] public-inbox-init: Initialize indexlevel Eric W. Biederman

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).