From bd0c436775fcbcff87c7f8451377bbb307ce96c7 Mon Sep 17 00:00:00 2001
From: JacquesDurand <59364973+JacquesDurand@users.noreply.github.com>
Date: Wed, 15 Feb 2023 15:20:26 +0100
Subject: [PATCH] chore: set cdn.dynamic to true by default in caddy (#307)
---
README.md | 4 ++--
plugins/caddy/README.md | 2 +-
plugins/caddy/configuration.go | 1 +
3 files changed, 4 insertions(+), 3 deletions(-)
diff --git a/README.md b/README.md
index fa94f2c36..cee920650 100644
--- a/README.md
+++ b/README.md
@@ -151,7 +151,7 @@ surrogate_keys:
The_Fourth_Test:
```
-| Key | Description | Value example |
+| Key | Description | Value example |
|:--------------------------------------------------|:--------------------------------------------------------------------------------------------------------------------------------------------|:--------------------------------------------------------------------------------------------------------------------------|
| `api` | The cache-handler API cache management | |
| `api.basepath` | BasePath for all APIs to avoid conflicts | `/your-non-conflicting-route`
`(default: /souin-api)` |
@@ -170,7 +170,7 @@ surrogate_keys:
| `cdn` | The CDN management, if you use any cdn to proxy your requests Souin will handle that | |
| `cdn.provider` | The provider placed before Souin | `akamai`
`fastly`
`souin` |
| `cdn.api_key` | The api key used to access to the provider | `XXXX` |
-| `cdn.dynamic` | Enable the dynamic keys returned by your backend application | `true`
`(default: false)` |
+| `cdn.dynamic` | Enable the dynamic keys returned by your backend application | `true`
`(default: false)`
`(default: true)` in the Caddy plugin if `cdn` is provided |
| `cdn.email` | The api key used to access to the provider if required, depending the provider | `XXXX` |
| `cdn.hostname` | The hostname if required, depending the provider | `domain.com` |
| `cdn.network` | The network if required, depending the provider | `your_network` |
diff --git a/plugins/caddy/README.md b/plugins/caddy/README.md
index b43db4648..d3117cc55 100644
--- a/plugins/caddy/README.md
+++ b/plugins/caddy/README.md
@@ -366,7 +366,7 @@ What does these directives mean?
| `cdn` | The CDN management, if you use any cdn to proxy your requests Souin will handle that | |
| `cdn.provider` | The provider placed before Souin | `akamai`
`fastly`
`souin` |
| `cdn.api_key` | The api key used to access to the provider | `XXXX` |
-| `cdn.dynamic` | Enable the dynamic keys returned by your backend application | `(default: false)` |
+| `cdn.dynamic` | Enable the dynamic keys returned by your backend application | `(default: true)` |
| `cdn.email` | The api key used to access to the provider if required, depending the provider | `XXXX` |
| `cdn.hostname` | The hostname if required, depending the provider | `domain.com` |
| `cdn.network` | The network if required, depending the provider | `your_network` |
diff --git a/plugins/caddy/configuration.go b/plugins/caddy/configuration.go
index 6a7e83abf..97679fb96 100644
--- a/plugins/caddy/configuration.go
+++ b/plugins/caddy/configuration.go
@@ -344,6 +344,7 @@ func parseConfiguration(cfg *Configuration, h *caddyfile.Dispenser, isBlocking b
cfg.DefaultCache.CacheName = args[0]
case "cdn":
cdn := configurationtypes.CDN{}
+ cdn.Dynamic = true
for nesting := h.Nesting(); h.NextBlock(nesting); {
directive := h.Val()
switch directive {