Skip to content

Commit

Permalink
fix(chore): caddy default provider check (#551)
Browse files Browse the repository at this point in the history
  • Loading branch information
darkweak authored Sep 19, 2024
1 parent 12a2857 commit 22abb94
Show file tree
Hide file tree
Showing 23 changed files with 45 additions and 41 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -952,7 +952,7 @@ experimental:
plugins:
souin:
moduleName: github.com/darkweak/souin
version: v1.7.0
version: v1.7.1
```
After that you can declare either the whole configuration at once in the middleware block or by service. See the examples below.
```yaml
Expand Down
4 changes: 2 additions & 2 deletions plugins/beego/go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ toolchain go1.22.4

require (
github.com/beego/beego/v2 v2.1.1
github.com/darkweak/souin v1.7.0
github.com/darkweak/souin v1.7.1
github.com/darkweak/souin/plugins/souin v0.0.0-00010101000000-000000000000
github.com/darkweak/souin/plugins/souin/storages v0.0.0-00010101000000-000000000000
)
Expand Down Expand Up @@ -184,7 +184,7 @@ require (
)

replace (
github.com/darkweak/souin v1.7.0 => ../..
github.com/darkweak/souin v1.7.1 => ../..
github.com/darkweak/souin/plugins/souin => ../souin
github.com/darkweak/souin/plugins/souin/storages => ../souin/storages
)
2 changes: 1 addition & 1 deletion plugins/caddy/dispatch.go
Original file line number Diff line number Diff line change
Expand Up @@ -121,7 +121,7 @@ func (s *SouinCaddyMiddleware) parseStorages(ctx caddy.Context) {
address := redis.URL
username := ""
dbname := "0"
cname := ""
cname := "souin-redis"
if c := redis.Configuration; c != nil {
p, ok := c.(map[string]interface{})
if ok {
Expand Down
4 changes: 2 additions & 2 deletions plugins/caddy/go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ go 1.22.1

require (
github.com/caddyserver/caddy/v2 v2.8.4
github.com/darkweak/souin v1.7.0
github.com/darkweak/souin v1.7.1
github.com/darkweak/storages/core v0.0.8
)

Expand Down Expand Up @@ -153,4 +153,4 @@ require (
howett.net/plist v1.0.0 // indirect
)

replace github.com/darkweak/souin v1.7.0 => ../..
replace github.com/darkweak/souin v1.7.1 => ../..
6 changes: 5 additions & 1 deletion plugins/caddy/httpcache.go
Original file line number Diff line number Diff line change
Expand Up @@ -116,6 +116,10 @@ func (s *SouinCaddyMiddleware) configurationPropertyMapper() error {
return nil
}

func isProviderEmpty(c configurationtypes.CacheProvider) bool {
return c.Configuration == nil && c.Path == "" && c.URL == ""
}

// FromApp to initialize configuration from App structure.
func (s *SouinCaddyMiddleware) FromApp(app *SouinApp) error {
if s.Configuration.GetDefaultCache() == nil {
Expand Down Expand Up @@ -199,7 +203,7 @@ func (s *SouinCaddyMiddleware) FromApp(app *SouinApp) error {
if dc.CacheName == "" {
s.Configuration.DefaultCache.CacheName = appDc.CacheName
}
if !s.Configuration.DefaultCache.Distributed && !dc.Olric.Found && !dc.Redis.Found && !dc.Etcd.Found && !dc.Badger.Found && !dc.Nuts.Found && !dc.Otter.Found {
if isProviderEmpty(dc.Badger) && isProviderEmpty(dc.Etcd) && isProviderEmpty(dc.Nats) && isProviderEmpty(dc.Nuts) && isProviderEmpty(dc.Olric) && isProviderEmpty(dc.Otter) && isProviderEmpty(dc.Redis) {
s.Configuration.DefaultCache.Distributed = appDc.Distributed
s.Configuration.DefaultCache.Olric = appDc.Olric
s.Configuration.DefaultCache.Redis = appDc.Redis
Expand Down
4 changes: 2 additions & 2 deletions plugins/chi/go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ module github.com/darkweak/souin/plugins/chi
go 1.22.1

require (
github.com/darkweak/souin v1.7.0
github.com/darkweak/souin v1.7.1
github.com/darkweak/souin/plugins/souin/storages v0.0.0-00010101000000-000000000000
github.com/go-chi/chi/v5 v5.0.12
)
Expand Down Expand Up @@ -179,6 +179,6 @@ require (
)

replace (
github.com/darkweak/souin v1.7.0 => ../..
github.com/darkweak/souin v1.7.1 => ../..
github.com/darkweak/souin/plugins/souin/storages => ../souin/storages
)
4 changes: 2 additions & 2 deletions plugins/dotweb/go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ module github.com/darkweak/souin/plugins/dotweb
go 1.22.1

require (
github.com/darkweak/souin v1.7.0
github.com/darkweak/souin v1.7.1
github.com/darkweak/souin/plugins/souin/storages v0.0.0-00010101000000-000000000000
github.com/devfeel/dotweb v1.7.21
)
Expand Down Expand Up @@ -180,6 +180,6 @@ require (
)

replace (
github.com/darkweak/souin v1.7.0 => ../..
github.com/darkweak/souin v1.7.1 => ../..
github.com/darkweak/souin/plugins/souin/storages => ../souin/storages
)
4 changes: 2 additions & 2 deletions plugins/echo/go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ module github.com/darkweak/souin/plugins/echo
go 1.22.1

require (
github.com/darkweak/souin v1.7.0
github.com/darkweak/souin v1.7.1
github.com/darkweak/souin/plugins/souin/storages v0.0.0-00010101000000-000000000000
github.com/darkweak/storages/core v0.0.8
github.com/labstack/echo/v4 v4.11.1
Expand Down Expand Up @@ -182,6 +182,6 @@ require (
)

replace (
github.com/darkweak/souin v1.7.0 => ../..
github.com/darkweak/souin v1.7.1 => ../..
github.com/darkweak/souin/plugins/souin/storages => ../souin/storages
)
4 changes: 2 additions & 2 deletions plugins/fiber/go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ module github.com/darkweak/souin/plugins/fiber
go 1.22.1

require (
github.com/darkweak/souin v1.7.0
github.com/darkweak/souin v1.7.1
github.com/darkweak/souin/plugins/souin/storages v0.0.0-00010101000000-000000000000
github.com/gofiber/fiber/v2 v2.52.1
github.com/valyala/fasthttp v1.51.0
Expand Down Expand Up @@ -185,6 +185,6 @@ require (
)

replace (
github.com/darkweak/souin v1.7.0 => ../..
github.com/darkweak/souin v1.7.1 => ../..
github.com/darkweak/souin/plugins/souin/storages => ../souin/storages
)
4 changes: 2 additions & 2 deletions plugins/gin/go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ module github.com/darkweak/souin/plugins/gin
go 1.22.1

require (
github.com/darkweak/souin v1.7.0
github.com/darkweak/souin v1.7.1
github.com/darkweak/souin/plugins/souin/storages v0.0.0-00010101000000-000000000000
github.com/gin-gonic/gin v1.9.1
)
Expand Down Expand Up @@ -196,6 +196,6 @@ require (
)

replace (
github.com/darkweak/souin v1.7.0 => ../..
github.com/darkweak/souin v1.7.1 => ../..
github.com/darkweak/souin/plugins/souin/storages => ../souin/storages
)
4 changes: 2 additions & 2 deletions plugins/go-zero/go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ module github.com/darkweak/souin/plugins/go-zero
go 1.22.1

require (
github.com/darkweak/souin v1.7.0
github.com/darkweak/souin v1.7.1
github.com/darkweak/souin/plugins/souin/storages v0.0.0-00010101000000-000000000000
github.com/zeromicro/go-zero v1.6.2
)
Expand Down Expand Up @@ -199,6 +199,6 @@ require (
)

replace (
github.com/darkweak/souin v1.7.0 => ../..
github.com/darkweak/souin v1.7.1 => ../..
github.com/darkweak/souin/plugins/souin/storages => ../souin/storages
)
4 changes: 2 additions & 2 deletions plugins/goa/go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ module github.com/darkweak/souin/plugins/goa
go 1.22.1

require (
github.com/darkweak/souin v1.7.0
github.com/darkweak/souin v1.7.1
github.com/darkweak/souin/plugins/souin/storages v0.0.0-00010101000000-000000000000
github.com/darkweak/storages/core v0.0.8
goa.design/goa/v3 v3.12.3
Expand Down Expand Up @@ -181,6 +181,6 @@ require (
)

replace (
github.com/darkweak/souin v1.7.0 => ../..
github.com/darkweak/souin v1.7.1 => ../..
github.com/darkweak/souin/plugins/souin/storages => ../souin/storages
)
4 changes: 2 additions & 2 deletions plugins/goyave/go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ module github.com/darkweak/souin/plugins/goyave
go 1.22.1

require (
github.com/darkweak/souin v1.7.0
github.com/darkweak/souin v1.7.1
github.com/darkweak/souin/plugins/souin/storages v0.0.0-00010101000000-000000000000
goyave.dev/goyave/v4 v4.4.11
)
Expand Down Expand Up @@ -186,6 +186,6 @@ require (
)

replace (
github.com/darkweak/souin v1.7.0 => ../..
github.com/darkweak/souin v1.7.1 => ../..
github.com/darkweak/souin/plugins/souin/storages => ../souin/storages
)
4 changes: 2 additions & 2 deletions plugins/hertz/go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ module github.com/darkweak/souin/plugins/hertz
go 1.22.1

require (
github.com/darkweak/souin v1.7.0
github.com/darkweak/souin v1.7.1
github.com/darkweak/souin/plugins/souin/storages v0.0.0-00010101000000-000000000000
)

Expand Down Expand Up @@ -195,6 +195,6 @@ require (
)

replace (
github.com/darkweak/souin v1.7.0 => ../..
github.com/darkweak/souin v1.7.1 => ../..
github.com/darkweak/souin/plugins/souin/storages => ../souin/storages
)
4 changes: 2 additions & 2 deletions plugins/kratos/go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ module github.com/darkweak/souin/plugins/kratos
go 1.22.1

require (
github.com/darkweak/souin v1.7.0
github.com/darkweak/souin v1.7.1
github.com/darkweak/souin/plugins/souin/storages v0.0.0-00010101000000-000000000000
github.com/go-kratos/kratos/v2 v2.7.0
gopkg.in/yaml.v3 v3.0.1
Expand Down Expand Up @@ -183,6 +183,6 @@ require (
)

replace (
github.com/darkweak/souin v1.7.0 => ../..
github.com/darkweak/souin v1.7.1 => ../..
github.com/darkweak/souin/plugins/souin/storages => ../souin/storages
)
4 changes: 2 additions & 2 deletions plugins/roadrunner/go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ module github.com/darkweak/souin/plugins/roadrunner
go 1.22.1

require (
github.com/darkweak/souin v1.7.0
github.com/darkweak/souin v1.7.1
github.com/darkweak/souin/plugins/souin v0.0.0-00010101000000-000000000000
github.com/darkweak/souin/plugins/souin/storages v0.0.0-00010101000000-000000000000
github.com/roadrunner-server/errors v1.3.0
Expand Down Expand Up @@ -180,7 +180,7 @@ require (
)

replace (
github.com/darkweak/souin v1.7.0 => ../..
github.com/darkweak/souin v1.7.1 => ../..
github.com/darkweak/souin/plugins/souin => ../souin
github.com/darkweak/souin/plugins/souin/storages => ../souin/storages
)
4 changes: 2 additions & 2 deletions plugins/skipper/go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ module github.com/darkweak/souin/plugins/skipper
go 1.22.1

require (
github.com/darkweak/souin v1.7.0
github.com/darkweak/souin v1.7.1
github.com/darkweak/souin/plugins/souin/storages v0.0.0-00010101000000-000000000000
github.com/zalando/skipper v0.16.145
)
Expand Down Expand Up @@ -219,6 +219,6 @@ require (
)

replace (
github.com/darkweak/souin v1.7.0 => ../..
github.com/darkweak/souin v1.7.1 => ../..
github.com/darkweak/souin/plugins/souin/storages => ../souin/storages
)
4 changes: 2 additions & 2 deletions plugins/souin/go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -3,12 +3,12 @@ module github.com/darkweak/souin/plugins/souin
go 1.22.1

replace (
github.com/darkweak/souin v1.7.0 => ../..
github.com/darkweak/souin v1.7.1 => ../..
github.com/darkweak/souin/plugins/souin/storages => ./storages
)

require (
github.com/darkweak/souin v1.7.0
github.com/darkweak/souin v1.7.1
github.com/darkweak/souin/plugins/souin/storages v0.0.0-00010101000000-000000000000
github.com/darkweak/storages/core v0.0.8
github.com/fsnotify/fsnotify v1.7.0
Expand Down
2 changes: 1 addition & 1 deletion plugins/souin/storages/go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ go 1.22.1
replace github.com/darkweak/souin => ../../..

require (
github.com/darkweak/souin v1.7.0
github.com/darkweak/souin v1.7.1
github.com/darkweak/storages/badger v0.0.8
github.com/darkweak/storages/core v0.0.8
github.com/darkweak/storages/etcd v0.0.8
Expand Down
4 changes: 2 additions & 2 deletions plugins/traefik/go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ go 1.22.1

require (
github.com/akyoto/cache v1.0.6
github.com/darkweak/souin v1.7.0
github.com/darkweak/souin v1.7.1
github.com/pquerna/cachecontrol v0.2.0
)

Expand Down Expand Up @@ -125,6 +125,6 @@ require (
)

replace (
github.com/darkweak/souin v1.7.0 => ../..
github.com/darkweak/souin v1.7.1 => ../..
go.uber.org/zap v1.26.0 => go.uber.org/zap v1.21.0
)
2 changes: 1 addition & 1 deletion plugins/traefik/vendor/modules.txt
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ github.com/cpuguy83/go-md2man/v2/md2man
# github.com/darkweak/go-esi v0.0.5
## explicit; go 1.18
github.com/darkweak/go-esi/esi
# github.com/darkweak/souin v1.7.0 => ../..
# github.com/darkweak/souin v1.7.1 => ../..
## explicit; go 1.22.1
github.com/darkweak/souin/configurationtypes
github.com/darkweak/souin/context
Expand Down
4 changes: 2 additions & 2 deletions plugins/tyk/go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ go 1.22.1
require (
github.com/TykTechnologies/tyk v1.9.2-0.20230330071232-370295d796b5
github.com/cespare/xxhash/v2 v2.2.0
github.com/darkweak/souin v1.7.0
github.com/darkweak/souin v1.7.1
github.com/darkweak/souin/plugins/souin v0.0.0-00010101000000-000000000000
github.com/patrickmn/go-cache v2.1.0+incompatible
github.com/pquerna/cachecontrol v0.2.0
Expand Down Expand Up @@ -182,7 +182,7 @@ require (
)

replace (
github.com/darkweak/souin v1.7.0 => ../..
github.com/darkweak/souin v1.7.1 => ../..
github.com/darkweak/souin/plugins/souin => ../souin
gopkg.in/alecthomas/kingpin.v2 v2.2.6 => github.com/alecthomas/kingpin/v2 v2.3.2
)
4 changes: 2 additions & 2 deletions plugins/webgo/go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ go 1.22.1

require (
github.com/bnkamalesh/webgo/v6 v6.7.0
github.com/darkweak/souin v1.7.0
github.com/darkweak/souin v1.7.1
github.com/darkweak/souin/plugins/souin/storages v0.0.0-00010101000000-000000000000
)

Expand Down Expand Up @@ -179,6 +179,6 @@ require (
)

replace (
github.com/darkweak/souin v1.7.0 => ../..
github.com/darkweak/souin v1.7.1 => ../..
github.com/darkweak/souin/plugins/souin/storages => ../souin/storages
)

0 comments on commit 22abb94

Please sign in to comment.