Skip to content

Commit

Permalink
fix(chore): caddy default provider check
Browse files Browse the repository at this point in the history
  • Loading branch information
darkweak committed Sep 18, 2024
1 parent 12a2857 commit 24829cb
Show file tree
Hide file tree
Showing 22 changed files with 44 additions and 40 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
)
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 24829cb

Please sign in to comment.