vim-dadbod icon indicating copy to clipboard operation
vim-dadbod copied to clipboard

Update redis to support tls redis (rediss:)

Open mikekwright opened this issue 1 year ago • 7 comments

There are two small changes in this PR.

  1. To correctly support user being supplied in the redis url for authentication.
  2. Enable rediss: as the means to support TLS for redis connections.

If there is a more concise way to be more DRY between the normal and tls redis adapters please let me know.

mikekwright avatar Sep 20 '24 03:09 mikekwright

  1. Enable rediss: as the means to support TLS for redis connections.

Is this a standard and/or popular convention, or is it something you invented? Most adapters use a query parameter for this. If we're inventing something, I'd rather invent one of those.

If there is a more concise way to be more DRY between the normal and tls redis adapters please let me know.

There's a couple of ways to alias adapter names.

tpope avatar Sep 20 '24 16:09 tpope

Is this a standard and/or popular convention, or is it something you invented? Most adapters use a query parameter for this. If we're inventing something, I'd rather invent one of those.

This is a great question, this appears to be the common way of supporting TLS as I see this used in a few of the official redis clients including: go-redis, ioredis and redis-py.

There's a couple of ways to alias adapter names.

Great, I will work on an implementation that uses this same pattern and update the PR accordingly. Any other requested changes?

mikekwright avatar Sep 20 '24 22:09 mikekwright

Is this a standard and/or popular convention, or is it something you invented? Most adapters use a query parameter for this. If we're inventing something, I'd rather invent one of those.

This is a great question, this appears to be the common way of supporting TLS as I see this used in a few of the official redis clients including: go-redis, ioredis and redis-py.

Okay, good enough.

There's a couple of ways to alias adapter names.

Great, I will work on an implementation that uses this same pattern and update the PR accordingly. Any other requested changes?

Needed to refresh my memory on how these work. The g:db_adapters form is strictly for alternate names for the same thing. The alias will be replaced with the canonical name during normalization.

The second form, used by redis+srv://, is what you want.

tpope avatar Sep 21 '24 01:09 tpope

Thanks for the guidance, I updated the PR, please let me know if this is more inline with what you would like to see.

mikekwright avatar Sep 21 '24 05:09 mikekwright

i was looking for this and got to change it like this in the adapter:

function! db#adapter#redis#interactive(url) abort
  let params = db#url#parse(a:url)
  return ['redis-cli'] + 
    \ (params.scheme ==# 'rediss' || get(params.params, 'tls', '') ==# 'true' ? ['--tls'] : []) +
    \ db#url#as_argv(a:url, '-h ', '-p ', '', '', '-a ', '-n ')
endfunction

and waiting until someone have a change about this (well this one just a temp stuff) but it works really well, i think you have the same implementation

padulkemid avatar Oct 08 '24 03:10 padulkemid

hi is this gonna be merged soon? @tpope @mikekwright

padulkemid avatar Nov 21 '24 22:11 padulkemid

@padulkemid I hope so, I am not seeing any other changes and just waiting for either a requested update or someone with write access to merge.

mikekwright avatar Dec 02 '24 20:12 mikekwright

@mikekwright I think mantainer is not available yet (I hope this can be merged soon to accomodate recent redis update so we're not changing the plugin manually)

padulkemid avatar May 02 '25 11:05 padulkemid

The problem is it's not sustainable for me to be responsible for database adapters I don't actively use, especially when I can't apt-get install them to easily things out. Going forward I will be encouraging people to create new plugins to house their adapter submissions, but I haven't decided what to do about the ones I'm already responsible for.

tpope avatar May 11 '25 18:05 tpope