depot/third_party/nixpkgs/pkgs/by-name/la/lanraragi/fix-minion-redis-password.patch
Default email 2c76a4cb41 Project import generated by Copybara.
GitOrigin-RevId: c757e9bd77b16ca2e03c89bf8bc9ecb28e0c06ad
2023-11-16 04:20:00 +00:00

34 lines
1.5 KiB
Diff

diff --git a/lib/LANraragi.pm b/lib/LANraragi.pm
index e6b833c4..d677030b 100644
--- a/lib/LANraragi.pm
+++ b/lib/LANraragi.pm
@@ -144,8 +144,13 @@ sub startup {
shutdown_from_pid( get_temp . "/minion.pid" );
my $miniondb = $self->LRR_CONF->get_redisad . "/" . $self->LRR_CONF->get_miniondb;
+ my $redispassword = $self->LRR_CONF->get_redispassword;
+
+ # If the password is non-empty, add the required delimiters
+ if ($redispassword) { $redispassword = "x:" . $redispassword . "@"; }
+
say "Minion will use the Redis database at $miniondb";
- $self->plugin( 'Minion' => { Redis => "redis://$miniondb" } );
+ $self->plugin( 'Minion' => { Redis => "redis://$redispassword$miniondb" } );
$self->LRR_LOGGER->info("Successfully connected to Minion database.");
$self->minion->missing_after(5); # Clean up older workers after 5 seconds of unavailability
diff --git a/lib/LANraragi/Model/Config.pm b/lib/LANraragi/Model/Config.pm
index f52056d4..63e1f5d3 100644
--- a/lib/LANraragi/Model/Config.pm
+++ b/lib/LANraragi/Model/Config.pm
@@ -42,8 +42,8 @@ sub get_minion {
my $miniondb = get_redisad . "/" . get_miniondb;
my $password = get_redispassword;
- # If the password is non-empty, add the required @
- if ($password) { $password = $password . "@"; }
+ # If the password is non-empty, add the required delimiters
+ if ($password) { $password = "x:" . $password . "@"; }
return Minion->new( Redis => "redis://$password$miniondb" );
}