Conversation
| {"database 3", "redis://localhost/3", "+OK\r\n", "*2\r\n$6\r\nSELECT\r\n$1\r\n3\r\n"}, | ||
| {"database 99", "redis://localhost/99", "+OK\r\n", "*2\r\n$6\r\nSELECT\r\n$2\r\n99\r\n"}, | ||
| {"no database", "redis://localhost/", "+OK\r\n", ""}, | ||
| {"database 99", "redis+socket://./server.sock?db=99", "+OK\r\n", "*2\r\n$6\r\nSELECT\r\n$2\r\n99\r\n"}, |
There was a problem hiding this comment.
Do we actually need to differentiate with a different prefix here or could we simplify by requiring all sock paths to be relative or absolute?
Relative must start with . and absolute must start with /?
There was a problem hiding this comment.
This is a good question. Original idea was to make url format similar to what other libraries have, but now I see there is no significant sense to have separate redis+socket scheme. Determining socket type by prefix is probably fine
There was a problem hiding this comment.
@stevenh I have tried to implement this, but there are tests like TestDialURL/password_no_host_db0 which logic collides with matching rules for absolute and relative paths (I've «stashed» code where tests was failing in de86cf4). So, now I think it is simpler to have a separate scheme for unix socket path, but maybe redis+unix is more obvious for a random user, idk
I've seen similar topic was mentioned in:
I see this package used by https://github.com/gocelery/gocelery which is used by one of the services I maintain. I think it is good to be able to pass Redis URL pointing to UNIX socket (from config file) even if IANA specification draft doesn't mention this particular URI scheme.
What do you think about this changeset?