Skip to content

Commit

Permalink
fix(configuration): enable cache only on prod env
Browse files Browse the repository at this point in the history
  • Loading branch information
darkweak committed Sep 12, 2023
1 parent 7ede32f commit b80d9ff
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 9 deletions.
18 changes: 11 additions & 7 deletions api/config/packages/api_platform.yaml
Expand Up @@ -3,18 +3,22 @@ api_platform:
version: 1.0.0
# Mercure integration, remove if unwanted
mercure: ~
http_cache:
public: true
invalidation:
enabled: true
purger: 'api_platform.http_cache.purger.souin'
urls: ['%env(SOUIN_API_URL)%']
# Good defaults for REST APIs
defaults:
stateless: true
cache_headers:
max_age: 0
shared_max_age: 3600
vary: ['Content-Type', 'Authorization', 'Origin']
extra_properties:
standard_put: true

when@prod:
defaults:
cache_headers:
shared_max_age: 3600
http_cache:
public: true
invalidation:
enabled: true
purger: 'api_platform.http_cache.purger.souin'
urls: ['%env(SOUIN_API_URL)%']
2 changes: 1 addition & 1 deletion docker-compose.prod.yml
Expand Up @@ -22,7 +22,7 @@ services:
environment:
MERCURE_PUBLISHER_JWT_KEY: ${CADDY_MERCURE_JWT_SECRET}
MERCURE_SUBSCRIBER_JWT_KEY: ${CADDY_MERCURE_JWT_SECRET}
CADDY_GLOBAL_OPTIONS: |
CADDY_GLOBAL_OPTIONS: |-
order cache before rewrite
cache {
api {
Expand Down
2 changes: 1 addition & 1 deletion docker-compose.yml
Expand Up @@ -36,7 +36,7 @@ services:
SERVER_NAME: ${SERVER_NAME:-localhost}, caddy:80
MERCURE_PUBLISHER_JWT_KEY: ${CADDY_MERCURE_JWT_SECRET:-!ChangeThisMercureHubJWTSecretKey!}
MERCURE_SUBSCRIBER_JWT_KEY: ${CADDY_MERCURE_JWT_SECRET:-!ChangeThisMercureHubJWTSecretKey!}
CADDY_GLOBAL_OPTIONS: |
CADDY_GLOBAL_OPTIONS: |-
order cache before rewrite
cache {
api {
Expand Down

0 comments on commit b80d9ff

Please sign in to comment.