From 3f7d26a0e3564406c9124288a80fa6a6eeadd81f Mon Sep 17 00:00:00 2001 From: Namekuji Date: Tue, 1 Aug 2023 12:52:00 -0400 Subject: [PATCH] Fix antenna migration for redis servers with password protection --- packages/backend/native-utils/migration/src/main.rs | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/packages/backend/native-utils/migration/src/main.rs b/packages/backend/native-utils/migration/src/main.rs index 896f1ed59..ca1246cf5 100644 --- a/packages/backend/native-utils/migration/src/main.rs +++ b/packages/backend/native-utils/migration/src/main.rs @@ -42,13 +42,15 @@ async fn main() { None => "redis", Some(_) => "rediss", }; - let redis_uri_userpass = match redis_conf.user { - None => "".to_string(), - Some(user) => format!("{}:{}@", user, encode(&redis_conf.pass.unwrap_or_default())), - }; + let redis_user = redis_conf.user.unwrap_or("default".to_string()); + let redis_uri_userpass = format!( + "{}:{}", + redis_user, + encode(&redis_conf.pass.unwrap_or_default()) + ); let redis_uri_hostport = format!("{}:{}", redis_conf.host, redis_conf.port); let redis_uri = format!( - "{}://{}{}/{}", + "{}://{}@{}/{}", redis_proto, redis_uri_userpass, redis_uri_hostport, redis_conf.db ); env::set_var(CACHE_URL_ENV, redis_uri);