Skip to content

Commit 2ec729b

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

File tree

3 files changed

+13
-9
lines changed

3 files changed

+13
-9
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: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ services:
2222
environment:
2323
MERCURE_PUBLISHER_JWT_KEY: ${CADDY_MERCURE_JWT_SECRET}
2424
MERCURE_SUBSCRIBER_JWT_KEY: ${CADDY_MERCURE_JWT_SECRET}
25-
CADDY_GLOBAL_OPTIONS: |
25+
CADDY_GLOBAL_OPTIONS: >
2626
order cache before rewrite
2727
cache {
2828
api {

docker-compose.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ services:
3636
SERVER_NAME: ${SERVER_NAME:-localhost}, caddy:80
3737
MERCURE_PUBLISHER_JWT_KEY: ${CADDY_MERCURE_JWT_SECRET:-!ChangeThisMercureHubJWTSecretKey!}
3838
MERCURE_SUBSCRIBER_JWT_KEY: ${CADDY_MERCURE_JWT_SECRET:-!ChangeThisMercureHubJWTSecretKey!}
39-
CADDY_GLOBAL_OPTIONS: |
39+
CADDY_GLOBAL_OPTIONS: >
4040
order cache before rewrite
4141
cache {
4242
api {

0 commit comments

Comments
 (0)