about summary refs log tree commit diff
path: root/nixpkgs/pkgs/by-name/la/lanraragi/fix-minion-redis-password.patch
blob: eb6b88f68f7f2a21dc031094888e58ab91af044b (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
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" );
 }