Skip to content

Constructors that accept a URI and a JedisClientConfig pull elements from both without documentation #3982

Closed
@joshrotenberg

Description

@joshrotenberg

UnifiedJedis and possibly other type constructors that accept a URI and a JedisClientConfig instantiate themselves with a mix of elements from both. This isn't unreasonable given that the URI can contain more than just host and port, but it isn't documented.

Options to fix it:

  • Document the current behavior
  • Update the constructors to let, for example, any config options win if both are specified, and document the behavior.

For example:

// works
UnifiedJedis jedis = new UnifiedJedis(new HostAndPort("localhost", 6379), DefaultJedisClientConfig.builder().user("username").password("password").build());

// also works
UnifiedJedis jedis2 = new UnifiedJedis(URI.create("redis://username:password@localhost:6379"));

// doesn't set auth correctly
UnifiedJedis ohNo = new UnifiedJedis(URI.create("redis://localhost:6379"), DefaultJedisClientConfig.builder().user("username").password("password").build());

See

.user(JedisURIHelper.getUser(uri)).password(JedisURIHelper.getPassword(uri))

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions