Skip to content
This repository was archived by the owner on Mar 19, 2024. It is now read-only.

Commit 4bf8db5

Browse files
committed
Add more parametrizable variables + descriptions in README.md
1 parent 66f955c commit 4bf8db5

File tree

2 files changed

+43
-14
lines changed

2 files changed

+43
-14
lines changed

Makefile

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11

22
# Use this tag to build a customized local image
33

4-
SWIFT_VERSION=5.1
5-
LAYER_VERSION=5-1
4+
SWIFT_VERSION?=5.1
5+
LAYER_VERSION?=5-1
66
# SWIFT_VERSION=5.0.3
77
# LAYER_VERSION=5-0-3
88
DOCKER_TAG=nio-swift:$(SWIFT_VERSION)

README.md

Lines changed: 41 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -140,9 +140,48 @@ make package_lambda
140140
```
141141
The output of this command is a ZIP file called `lambda.zip` under the folder `.build`.
142142

143-
**Note:**
143+
# Lambda Configuration
144+
145+
## Parametrized calls / Automation
146+
147+
Can pass values to your `make` command either before or after the call like below. This will fit better in a script per example to setup continuous integration in your project.
148+
149+
### Before `make`
144150

145-
Edit the `Makefile` to build a different Example by commenting the following lines and uncommenting the line relateted to the example you want to build.
151+
```
152+
SWIFT_EXECUTABLE=HTTPSRequest \
153+
SWIFT_PROJECT_PATH=Examples/HTTPSRequest \
154+
LAMBDA_FUNCTION_NAME=HTTPSRequest \
155+
LAMBDA_HANDLER=${SWIFT_EXECUTABLE}.getHttps \
156+
make invoke_lambda
157+
```
158+
159+
### After `make`
160+
161+
```
162+
make invoke_lambda \
163+
SWIFT_EXECUTABLE=HTTPSRequest \
164+
SWIFT_PROJECT_PATH=Examples/HTTPSRequest \
165+
LAMBDA_FUNCTION_NAME=HTTPSRequest \
166+
LAMBDA_HANDLER=${SWIFT_EXECUTABLE}.getHttps
167+
```
168+
169+
### Parameters you can pass
170+
171+
| Key | Usage | Default |
172+
| --- | --- | --- |
173+
| AWS_BUCKET | The AWS S3 bucket where your lambda artifacts get uploaded. | my-s3-bucket |
174+
| AWS_PROFILE | An AWS AIM profile you create to authenticate to your account. | default |
175+
| SWIFT_VERSION | Version of Swift used / Matches Dockerfile location too from `docker/` folder. | 5.1 |
176+
| LAYER_VERSION | Version of the Swift layer that will be created and uploaded for the Lambda to run on. | 5-1 |
177+
| SWIFT_EXECUTABLE | Name of the binary file. | HelloWorld |
178+
| SWIFT_PROJECT_PATH | Path to your Swift project. | Examples/HelloWorld |
179+
| LAMBDA_FUNCTION_NAME | Display name of your Lambda in AWS. | HelloWorld |
180+
| LAMBDA_HANDLER | Name of your lambda handler function. If you declare it using `sprinter.register(handler: "FUNCTION_NAME", lambda: syncLambda)` you should declare it as `<SWIFT_EXECUTABLE>.<FUNCTION_NAME>`. | $(SWIFT_EXECUTABLE).helloWorld |
181+
182+
## Manual change
183+
184+
You can also edit the `Makefile` to build a different Example by commenting the following lines and uncommenting the line relateted to the example you want to build.
146185
```
147186
...
148187
@@ -154,16 +193,6 @@ LAMBDA_HANDLER?=$(SWIFT_EXECUTABLE).helloWorld
154193
...
155194
```
156195

157-
You can also override these by passing values in the make command like below.
158-
159-
```
160-
SWIFT_EXECUTABLE=HTTPSRequest \
161-
SWIFT_PROJECT_PATH=Examples/HTTPSRequest \
162-
LAMBDA_FUNCTION_NAME=HTTPSRequest \
163-
LAMBDA_HANDLER=${SWIFT_EXECUTABLE}.getHttps \
164-
make invoke_lambda
165-
```
166-
167196
# Lambda Deployment Workflow
168197

169198
The folowing tutorial describes how to deploy the lambda in your AWS account from the command line using [AWS Command Line Interface](https://docs.aws.amazon.com/cli/latest/userguide/cli-chap-welcome.html) through the `Makefile`.

0 commit comments

Comments
 (0)