Skip to content

Commit 22abb94

Browse files
authored
fix(chore): caddy default provider check (#551)
1 parent 12a2857 commit 22abb94

File tree

23 files changed

+45
-41
lines changed

23 files changed

+45
-41
lines changed

README.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -952,7 +952,7 @@ experimental:
952952
plugins:
953953
souin:
954954
moduleName: github.com/darkweak/souin
955-
version: v1.7.0
955+
version: v1.7.1
956956
```
957957
After that you can declare either the whole configuration at once in the middleware block or by service. See the examples below.
958958
```yaml

plugins/beego/go.mod

+2-2
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ toolchain go1.22.4
66

77
require (
88
github.com/beego/beego/v2 v2.1.1
9-
github.com/darkweak/souin v1.7.0
9+
github.com/darkweak/souin v1.7.1
1010
github.com/darkweak/souin/plugins/souin v0.0.0-00010101000000-000000000000
1111
github.com/darkweak/souin/plugins/souin/storages v0.0.0-00010101000000-000000000000
1212
)
@@ -184,7 +184,7 @@ require (
184184
)
185185

186186
replace (
187-
github.com/darkweak/souin v1.7.0 => ../..
187+
github.com/darkweak/souin v1.7.1 => ../..
188188
github.com/darkweak/souin/plugins/souin => ../souin
189189
github.com/darkweak/souin/plugins/souin/storages => ../souin/storages
190190
)

plugins/caddy/dispatch.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -121,7 +121,7 @@ func (s *SouinCaddyMiddleware) parseStorages(ctx caddy.Context) {
121121
address := redis.URL
122122
username := ""
123123
dbname := "0"
124-
cname := ""
124+
cname := "souin-redis"
125125
if c := redis.Configuration; c != nil {
126126
p, ok := c.(map[string]interface{})
127127
if ok {

plugins/caddy/go.mod

+2-2
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ go 1.22.1
44

55
require (
66
github.com/caddyserver/caddy/v2 v2.8.4
7-
github.com/darkweak/souin v1.7.0
7+
github.com/darkweak/souin v1.7.1
88
github.com/darkweak/storages/core v0.0.8
99
)
1010

@@ -153,4 +153,4 @@ require (
153153
howett.net/plist v1.0.0 // indirect
154154
)
155155

156-
replace github.com/darkweak/souin v1.7.0 => ../..
156+
replace github.com/darkweak/souin v1.7.1 => ../..

plugins/caddy/httpcache.go

+5-1
Original file line numberDiff line numberDiff line change
@@ -116,6 +116,10 @@ func (s *SouinCaddyMiddleware) configurationPropertyMapper() error {
116116
return nil
117117
}
118118

119+
func isProviderEmpty(c configurationtypes.CacheProvider) bool {
120+
return c.Configuration == nil && c.Path == "" && c.URL == ""
121+
}
122+
119123
// FromApp to initialize configuration from App structure.
120124
func (s *SouinCaddyMiddleware) FromApp(app *SouinApp) error {
121125
if s.Configuration.GetDefaultCache() == nil {
@@ -199,7 +203,7 @@ func (s *SouinCaddyMiddleware) FromApp(app *SouinApp) error {
199203
if dc.CacheName == "" {
200204
s.Configuration.DefaultCache.CacheName = appDc.CacheName
201205
}
202-
if !s.Configuration.DefaultCache.Distributed && !dc.Olric.Found && !dc.Redis.Found && !dc.Etcd.Found && !dc.Badger.Found && !dc.Nuts.Found && !dc.Otter.Found {
206+
if isProviderEmpty(dc.Badger) && isProviderEmpty(dc.Etcd) && isProviderEmpty(dc.Nats) && isProviderEmpty(dc.Nuts) && isProviderEmpty(dc.Olric) && isProviderEmpty(dc.Otter) && isProviderEmpty(dc.Redis) {
203207
s.Configuration.DefaultCache.Distributed = appDc.Distributed
204208
s.Configuration.DefaultCache.Olric = appDc.Olric
205209
s.Configuration.DefaultCache.Redis = appDc.Redis

plugins/chi/go.mod

+2-2
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ module github.com/darkweak/souin/plugins/chi
33
go 1.22.1
44

55
require (
6-
github.com/darkweak/souin v1.7.0
6+
github.com/darkweak/souin v1.7.1
77
github.com/darkweak/souin/plugins/souin/storages v0.0.0-00010101000000-000000000000
88
github.com/go-chi/chi/v5 v5.0.12
99
)
@@ -179,6 +179,6 @@ require (
179179
)
180180

181181
replace (
182-
github.com/darkweak/souin v1.7.0 => ../..
182+
github.com/darkweak/souin v1.7.1 => ../..
183183
github.com/darkweak/souin/plugins/souin/storages => ../souin/storages
184184
)

plugins/dotweb/go.mod

+2-2
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ module github.com/darkweak/souin/plugins/dotweb
33
go 1.22.1
44

55
require (
6-
github.com/darkweak/souin v1.7.0
6+
github.com/darkweak/souin v1.7.1
77
github.com/darkweak/souin/plugins/souin/storages v0.0.0-00010101000000-000000000000
88
github.com/devfeel/dotweb v1.7.21
99
)
@@ -180,6 +180,6 @@ require (
180180
)
181181

182182
replace (
183-
github.com/darkweak/souin v1.7.0 => ../..
183+
github.com/darkweak/souin v1.7.1 => ../..
184184
github.com/darkweak/souin/plugins/souin/storages => ../souin/storages
185185
)

plugins/echo/go.mod

+2-2
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ module github.com/darkweak/souin/plugins/echo
33
go 1.22.1
44

55
require (
6-
github.com/darkweak/souin v1.7.0
6+
github.com/darkweak/souin v1.7.1
77
github.com/darkweak/souin/plugins/souin/storages v0.0.0-00010101000000-000000000000
88
github.com/darkweak/storages/core v0.0.8
99
github.com/labstack/echo/v4 v4.11.1
@@ -182,6 +182,6 @@ require (
182182
)
183183

184184
replace (
185-
github.com/darkweak/souin v1.7.0 => ../..
185+
github.com/darkweak/souin v1.7.1 => ../..
186186
github.com/darkweak/souin/plugins/souin/storages => ../souin/storages
187187
)

plugins/fiber/go.mod

+2-2
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ module github.com/darkweak/souin/plugins/fiber
33
go 1.22.1
44

55
require (
6-
github.com/darkweak/souin v1.7.0
6+
github.com/darkweak/souin v1.7.1
77
github.com/darkweak/souin/plugins/souin/storages v0.0.0-00010101000000-000000000000
88
github.com/gofiber/fiber/v2 v2.52.1
99
github.com/valyala/fasthttp v1.51.0
@@ -185,6 +185,6 @@ require (
185185
)
186186

187187
replace (
188-
github.com/darkweak/souin v1.7.0 => ../..
188+
github.com/darkweak/souin v1.7.1 => ../..
189189
github.com/darkweak/souin/plugins/souin/storages => ../souin/storages
190190
)

plugins/gin/go.mod

+2-2
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ module github.com/darkweak/souin/plugins/gin
33
go 1.22.1
44

55
require (
6-
github.com/darkweak/souin v1.7.0
6+
github.com/darkweak/souin v1.7.1
77
github.com/darkweak/souin/plugins/souin/storages v0.0.0-00010101000000-000000000000
88
github.com/gin-gonic/gin v1.9.1
99
)
@@ -196,6 +196,6 @@ require (
196196
)
197197

198198
replace (
199-
github.com/darkweak/souin v1.7.0 => ../..
199+
github.com/darkweak/souin v1.7.1 => ../..
200200
github.com/darkweak/souin/plugins/souin/storages => ../souin/storages
201201
)

plugins/go-zero/go.mod

+2-2
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ module github.com/darkweak/souin/plugins/go-zero
33
go 1.22.1
44

55
require (
6-
github.com/darkweak/souin v1.7.0
6+
github.com/darkweak/souin v1.7.1
77
github.com/darkweak/souin/plugins/souin/storages v0.0.0-00010101000000-000000000000
88
github.com/zeromicro/go-zero v1.6.2
99
)
@@ -199,6 +199,6 @@ require (
199199
)
200200

201201
replace (
202-
github.com/darkweak/souin v1.7.0 => ../..
202+
github.com/darkweak/souin v1.7.1 => ../..
203203
github.com/darkweak/souin/plugins/souin/storages => ../souin/storages
204204
)

plugins/goa/go.mod

+2-2
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ module github.com/darkweak/souin/plugins/goa
33
go 1.22.1
44

55
require (
6-
github.com/darkweak/souin v1.7.0
6+
github.com/darkweak/souin v1.7.1
77
github.com/darkweak/souin/plugins/souin/storages v0.0.0-00010101000000-000000000000
88
github.com/darkweak/storages/core v0.0.8
99
goa.design/goa/v3 v3.12.3
@@ -181,6 +181,6 @@ require (
181181
)
182182

183183
replace (
184-
github.com/darkweak/souin v1.7.0 => ../..
184+
github.com/darkweak/souin v1.7.1 => ../..
185185
github.com/darkweak/souin/plugins/souin/storages => ../souin/storages
186186
)

plugins/goyave/go.mod

+2-2
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ module github.com/darkweak/souin/plugins/goyave
33
go 1.22.1
44

55
require (
6-
github.com/darkweak/souin v1.7.0
6+
github.com/darkweak/souin v1.7.1
77
github.com/darkweak/souin/plugins/souin/storages v0.0.0-00010101000000-000000000000
88
goyave.dev/goyave/v4 v4.4.11
99
)
@@ -186,6 +186,6 @@ require (
186186
)
187187

188188
replace (
189-
github.com/darkweak/souin v1.7.0 => ../..
189+
github.com/darkweak/souin v1.7.1 => ../..
190190
github.com/darkweak/souin/plugins/souin/storages => ../souin/storages
191191
)

plugins/hertz/go.mod

+2-2
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ module github.com/darkweak/souin/plugins/hertz
33
go 1.22.1
44

55
require (
6-
github.com/darkweak/souin v1.7.0
6+
github.com/darkweak/souin v1.7.1
77
github.com/darkweak/souin/plugins/souin/storages v0.0.0-00010101000000-000000000000
88
)
99

@@ -195,6 +195,6 @@ require (
195195
)
196196

197197
replace (
198-
github.com/darkweak/souin v1.7.0 => ../..
198+
github.com/darkweak/souin v1.7.1 => ../..
199199
github.com/darkweak/souin/plugins/souin/storages => ../souin/storages
200200
)

plugins/kratos/go.mod

+2-2
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ module github.com/darkweak/souin/plugins/kratos
33
go 1.22.1
44

55
require (
6-
github.com/darkweak/souin v1.7.0
6+
github.com/darkweak/souin v1.7.1
77
github.com/darkweak/souin/plugins/souin/storages v0.0.0-00010101000000-000000000000
88
github.com/go-kratos/kratos/v2 v2.7.0
99
gopkg.in/yaml.v3 v3.0.1
@@ -183,6 +183,6 @@ require (
183183
)
184184

185185
replace (
186-
github.com/darkweak/souin v1.7.0 => ../..
186+
github.com/darkweak/souin v1.7.1 => ../..
187187
github.com/darkweak/souin/plugins/souin/storages => ../souin/storages
188188
)

plugins/roadrunner/go.mod

+2-2
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ module github.com/darkweak/souin/plugins/roadrunner
33
go 1.22.1
44

55
require (
6-
github.com/darkweak/souin v1.7.0
6+
github.com/darkweak/souin v1.7.1
77
github.com/darkweak/souin/plugins/souin v0.0.0-00010101000000-000000000000
88
github.com/darkweak/souin/plugins/souin/storages v0.0.0-00010101000000-000000000000
99
github.com/roadrunner-server/errors v1.3.0
@@ -180,7 +180,7 @@ require (
180180
)
181181

182182
replace (
183-
github.com/darkweak/souin v1.7.0 => ../..
183+
github.com/darkweak/souin v1.7.1 => ../..
184184
github.com/darkweak/souin/plugins/souin => ../souin
185185
github.com/darkweak/souin/plugins/souin/storages => ../souin/storages
186186
)

plugins/skipper/go.mod

+2-2
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ module github.com/darkweak/souin/plugins/skipper
33
go 1.22.1
44

55
require (
6-
github.com/darkweak/souin v1.7.0
6+
github.com/darkweak/souin v1.7.1
77
github.com/darkweak/souin/plugins/souin/storages v0.0.0-00010101000000-000000000000
88
github.com/zalando/skipper v0.16.145
99
)
@@ -219,6 +219,6 @@ require (
219219
)
220220

221221
replace (
222-
github.com/darkweak/souin v1.7.0 => ../..
222+
github.com/darkweak/souin v1.7.1 => ../..
223223
github.com/darkweak/souin/plugins/souin/storages => ../souin/storages
224224
)

plugins/souin/go.mod

+2-2
Original file line numberDiff line numberDiff line change
@@ -3,12 +3,12 @@ module github.com/darkweak/souin/plugins/souin
33
go 1.22.1
44

55
replace (
6-
github.com/darkweak/souin v1.7.0 => ../..
6+
github.com/darkweak/souin v1.7.1 => ../..
77
github.com/darkweak/souin/plugins/souin/storages => ./storages
88
)
99

1010
require (
11-
github.com/darkweak/souin v1.7.0
11+
github.com/darkweak/souin v1.7.1
1212
github.com/darkweak/souin/plugins/souin/storages v0.0.0-00010101000000-000000000000
1313
github.com/darkweak/storages/core v0.0.8
1414
github.com/fsnotify/fsnotify v1.7.0

plugins/souin/storages/go.mod

+1-1
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ go 1.22.1
55
replace github.com/darkweak/souin => ../../..
66

77
require (
8-
github.com/darkweak/souin v1.7.0
8+
github.com/darkweak/souin v1.7.1
99
github.com/darkweak/storages/badger v0.0.8
1010
github.com/darkweak/storages/core v0.0.8
1111
github.com/darkweak/storages/etcd v0.0.8

plugins/traefik/go.mod

+2-2
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ go 1.22.1
44

55
require (
66
github.com/akyoto/cache v1.0.6
7-
github.com/darkweak/souin v1.7.0
7+
github.com/darkweak/souin v1.7.1
88
github.com/pquerna/cachecontrol v0.2.0
99
)
1010

@@ -125,6 +125,6 @@ require (
125125
)
126126

127127
replace (
128-
github.com/darkweak/souin v1.7.0 => ../..
128+
github.com/darkweak/souin v1.7.1 => ../..
129129
go.uber.org/zap v1.26.0 => go.uber.org/zap v1.21.0
130130
)

plugins/traefik/vendor/modules.txt

+1-1
Original file line numberDiff line numberDiff line change
@@ -66,7 +66,7 @@ github.com/cpuguy83/go-md2man/v2/md2man
6666
# github.com/darkweak/go-esi v0.0.5
6767
## explicit; go 1.18
6868
github.com/darkweak/go-esi/esi
69-
# github.com/darkweak/souin v1.7.0 => ../..
69+
# github.com/darkweak/souin v1.7.1 => ../..
7070
## explicit; go 1.22.1
7171
github.com/darkweak/souin/configurationtypes
7272
github.com/darkweak/souin/context

plugins/tyk/go.mod

+2-2
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ go 1.22.1
55
require (
66
github.com/TykTechnologies/tyk v1.9.2-0.20230330071232-370295d796b5
77
github.com/cespare/xxhash/v2 v2.2.0
8-
github.com/darkweak/souin v1.7.0
8+
github.com/darkweak/souin v1.7.1
99
github.com/darkweak/souin/plugins/souin v0.0.0-00010101000000-000000000000
1010
github.com/patrickmn/go-cache v2.1.0+incompatible
1111
github.com/pquerna/cachecontrol v0.2.0
@@ -182,7 +182,7 @@ require (
182182
)
183183

184184
replace (
185-
github.com/darkweak/souin v1.7.0 => ../..
185+
github.com/darkweak/souin v1.7.1 => ../..
186186
github.com/darkweak/souin/plugins/souin => ../souin
187187
gopkg.in/alecthomas/kingpin.v2 v2.2.6 => github.com/alecthomas/kingpin/v2 v2.3.2
188188
)

plugins/webgo/go.mod

+2-2
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ go 1.22.1
44

55
require (
66
github.com/bnkamalesh/webgo/v6 v6.7.0
7-
github.com/darkweak/souin v1.7.0
7+
github.com/darkweak/souin v1.7.1
88
github.com/darkweak/souin/plugins/souin/storages v0.0.0-00010101000000-000000000000
99
)
1010

@@ -179,6 +179,6 @@ require (
179179
)
180180

181181
replace (
182-
github.com/darkweak/souin v1.7.0 => ../..
182+
github.com/darkweak/souin v1.7.1 => ../..
183183
github.com/darkweak/souin/plugins/souin/storages => ../souin/storages
184184
)

0 commit comments

Comments
 (0)