@@ -18,6 +18,7 @@ def initialize(options)
1818 @node_opts = build_node_options ( node_addrs )
1919 @replica = options . delete ( :replica ) == true
2020 add_common_node_option_if_needed ( options , @node_opts , :scheme )
21+ add_common_node_option_if_needed ( options , @node_opts , :username )
2122 add_common_node_option_if_needed ( options , @node_opts , :password )
2223 @options = options
2324 end
@@ -63,7 +64,9 @@ def parse_node_url(addr)
6364 raise InvalidClientOptionError , "Invalid uri scheme #{ addr } " unless VALID_SCHEMES . include? ( uri . scheme )
6465
6566 db = uri . path . split ( '/' ) [ 1 ] &.to_i
66- { scheme : uri . scheme , password : uri . password , host : uri . host , port : uri . port , db : db } . reject { |_ , v | v . nil? }
67+
68+ { scheme : uri . scheme , username : uri . user , password : uri . password , host : uri . host , port : uri . port , db : db }
69+ . reject { |_ , v | v . nil? || v == '' }
6770 rescue URI ::InvalidURIError => err
6871 raise InvalidClientOptionError , err . message
6972 end
@@ -79,7 +82,7 @@ def parse_node_option(addr)
7982
8083 # Redis cluster node returns only host and port information.
8184 # So we should complement additional information such as:
82- # scheme, password and so on.
85+ # scheme, username, password and so on.
8386 def add_common_node_option_if_needed ( options , node_opts , key )
8487 return options if options [ key ] . nil? && node_opts . first [ key ] . nil?
8588
0 commit comments