Skip to content

Commit 4cc436c

Browse files
authored
Merge pull request #567 from aligent/chore/566_add-apigateway-property-to-provider-in-documentation-example
Chore/566 add apigateway property to provider in documentation example
2 parents 1fbe8a4 + cb06932 commit 4cc436c

File tree

1 file changed

+6
-5
lines changed

1 file changed

+6
-5
lines changed

README.md

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -879,18 +879,19 @@ You can input an value as json in request body, the value is passed as the input
879879

880880
#### Setting API keys for your Rest API
881881

882-
You can specify a list of API keys to be used by your service Rest API by adding an apiKeys array property to the provider object in serverless.yml. You'll also need to explicitly specify which endpoints are private and require one of the api keys to be included in the request by adding a private boolean property to the http event object you want to set as private. API Keys are created globally, so if you want to deploy your service to different stages make sure your API key contains a stage variable as defined below. When using API keys, you can optionally define usage plan quota and throttle, using usagePlan object.
882+
You can specify a list of API keys to be used by your service Rest API by adding an apiKeys array property to the apiGateway subsection of the provider object in serverless.yml. You'll also need to explicitly specify which endpoints are private and require one of the api keys to be included in the request by adding a private boolean property to the http event object you want to set as private. API Keys are created globally, so if you want to deploy your service to different stages make sure your API key contains a stage variable as defined below. When using API keys, you can optionally define usage plan quota and throttle, using usagePlan object.
883883

884884
Here's an example configuration for setting API keys for your service Rest API:
885885

886886
```yml
887887
service: my-service
888888
provider:
889889
name: aws
890-
apiKeys:
891-
- myFirstKey
892-
- ${opt:stage}-myFirstKey
893-
- ${env:MY_API_KEY} # you can hide it in a serverless variable
890+
apiGateway:
891+
apiKeys:
892+
- myFirstKey
893+
- ${opt:stage}-myFirstKey
894+
- ${env:MY_API_KEY} # you can hide it in a serverless variable
894895
usagePlan:
895896
quota:
896897
limit: 5000

0 commit comments

Comments
 (0)