gamalan / caddy-tlsredis

Redis Storage using for Caddy TLS Data
Apache License 2.0
95 stars 31 forks source link

Caddy storage export command always results in an empty tar #50

Closed pberkel closed 1 year ago

pberkel commented 1 year ago

I am able to replicate issue #46 reported by @jum, it appears when the caddy storage export command iterates over the keys, it expects KeyInfo.IsTerminal returned by Stat() to be true in order to include in the exported tar file:

https://github.com/caddyserver/caddy/blob/4e8245df0b289007e84f42212977ea0bd27826d5/cmd/storagefuncs.go#L196

This makes sense since each key returned by List() in this Redis storage implementation is a data object and not a directory object. Unfortunately KeyInfo.IsTerminal is currently hard-coded to false and thus no keys are included in the export:

https://github.com/gamalan/caddy-tlsredis/blob/1d90bd3f80cb3c600e4c756d431cfb831f6a1c10/storageredis.go#L491

This PR simply changes the hard-coded value of KeyInfo.IsTerminal from false to true when then allows all keys stored in Redis to be exported correctly.

CC: @francislavoie

gamalan commented 1 year ago

sorry, having family health issue these past weeks.

francislavoie commented 1 year ago

No worries 🫶 thanks for merging, and I hope your situation improves!

pberkel commented 1 year ago

Thanks for merging @gamalan could I please ask you to create a new tag for this change?