Skip to content

Commit 6f0fb64

Browse files
committed
fix(configuration): enable cache only on prod env
1 parent 7ede32f commit 6f0fb64

File tree

3 files changed

+23
-19
lines changed

3 files changed

+23
-19
lines changed

api/config/packages/api_platform.yaml

Lines changed: 11 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -3,18 +3,22 @@ api_platform:
33
version: 1.0.0
44
# Mercure integration, remove if unwanted
55
mercure: ~
6-
http_cache:
7-
public: true
8-
invalidation:
9-
enabled: true
10-
purger: 'api_platform.http_cache.purger.souin'
11-
urls: ['%env(SOUIN_API_URL)%']
126
# Good defaults for REST APIs
137
defaults:
148
stateless: true
159
cache_headers:
1610
max_age: 0
17-
shared_max_age: 3600
1811
vary: ['Content-Type', 'Authorization', 'Origin']
1912
extra_properties:
2013
standard_put: true
14+
15+
when@prod:
16+
defaults:
17+
cache_headers:
18+
shared_max_age: 3600
19+
http_cache:
20+
public: true
21+
invalidation:
22+
enabled: true
23+
purger: 'api_platform.http_cache.purger.souin'
24+
urls: ['%env(SOUIN_API_URL)%']

docker-compose.prod.yml

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -23,12 +23,12 @@ services:
2323
MERCURE_PUBLISHER_JWT_KEY: ${CADDY_MERCURE_JWT_SECRET}
2424
MERCURE_SUBSCRIBER_JWT_KEY: ${CADDY_MERCURE_JWT_SECRET}
2525
CADDY_GLOBAL_OPTIONS: |
26-
order cache before rewrite
27-
cache {
28-
api {
29-
souin
30-
}
31-
}
26+
order cache before rewrite
27+
cache {
28+
api {
29+
souin
30+
}
31+
}
3232
3333
database:
3434
environment:

docker-compose.yml

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -37,12 +37,12 @@ services:
3737
MERCURE_PUBLISHER_JWT_KEY: ${CADDY_MERCURE_JWT_SECRET:-!ChangeThisMercureHubJWTSecretKey!}
3838
MERCURE_SUBSCRIBER_JWT_KEY: ${CADDY_MERCURE_JWT_SECRET:-!ChangeThisMercureHubJWTSecretKey!}
3939
CADDY_GLOBAL_OPTIONS: |
40-
order cache before rewrite
41-
cache {
42-
api {
43-
souin
44-
}
45-
}
40+
order cache before rewrite
41+
cache {
42+
api {
43+
souin
44+
}
45+
}
4646
restart: unless-stopped
4747
volumes:
4848
- php_socket:/var/run/php

0 commit comments

Comments
 (0)