Skip to content

Commit 0934aee

Browse files
author
Allegra Chen
committed
Update README.md
1 parent ae9f6f3 commit 0934aee

File tree

1 file changed

+11
-1
lines changed

1 file changed

+11
-1
lines changed

README.md

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,10 +19,13 @@ functions:
1919
handler: lambdaEdge/viewerRequest.handler
2020
events:
2121
- preExistingCloudFront:
22+
# ---- Mandatory Properties -----
2223
distributionId: xxxxxxx # CloudFront distribution ID you want to associate
2324
eventType: viewer-request # Choose event to trigger your Lambda function, which are `viewer-request`, `origin-request`, `origin-response` or `viewer-response`
2425
pathPattern: '*' # Specifying the CloudFront behavior
2526
includeBody: false # Whether including body or not within request
27+
# ---- Optional Property -----
28+
stage: dev # Specify the stage at which you want this CloudFront distribution to be updated
2629

2730
plugins:
2831
- serverless-lambda-edge-pre-existing-cloudfront
@@ -41,4 +44,11 @@ lambdaEdgePreExistingCloudFront:
4144
validStages:
4245
- staging
4346
- production
44-
```
47+
```
48+
49+
### How `validStages` and `stage` properties work
50+
This plugin will first check for `validStages` property defined in the `custom` section. If `validStages` is used, then all the `preExistingCloudFront` events are only possible to be updated at the `validStages`. If not used, all the `preExistingCloudFront` events are possible to be updated at any stage.
51+
52+
Then at all valid stages, the plugin checks - for each `preExistingCloudFront` event - if the provider's stage is the same as the `stage` property defined for each `preExistingCloudFront` event. If they match, then that particular `preExistingCloudFront` event will be updated.
53+
54+
If `stage` is not used for a `preExistingCloudFront` event, then that event will be updated at all `validStages` or all stages if `validStages` is not used.

0 commit comments

Comments
 (0)