Skip to content

Commit

Permalink
Merge pull request #95 from noppoMan/extendable-memory-useage
Browse files Browse the repository at this point in the history
make memory size changeable. (default is 128MB)
  • Loading branch information
noppoMan committed Dec 17, 2017
2 parents 29f6ffc + 258b0af commit ed68dda
Show file tree
Hide file tree
Showing 3 changed files with 21 additions and 13 deletions.
31 changes: 18 additions & 13 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@ Current default tool version is `4.0`

If the tool version is higher than 3.1, layouts and definiations of `Package.swift` are refined.

**EX.**
**e.g.**
```sh
# swift.version will be 4.0
hexaville generate Hello
Expand Down Expand Up @@ -279,6 +279,21 @@ FACEBOOK_APP_ID=xxxxxxx
FACEBOOK_APP_SECRET=xxxxxxx
```

## Extending Basic Settings

You can extend followings settings at `lambda` property in `Hexavillefile.yml`

* `Timeout`: Default is 10. Timeout limit is described at `Integration Timeout` section in [API Gateway's developer guide](http://docs.aws.amazon.com/apigateway/latest/developerguide/limits.html#api-gateway-limits).
* `Memory`: Default is 128(MB). Memory allocation range is described at `Memory allocation range` section in [Lambda's developer guide](http://docs.aws.amazon.com/lambda/latest/dg/limits.html).

**e.g.**
```yaml
aws:
lambda:
timeout: 20
memory: 1024
```
## VPC
You can add VPC configuration to the lambda function in Hexavillefile.yml by adding a vpc object property in the lambda configuration section. This object should contain the securityGroupIds and subnetIds array properties needed to construct VPC for this function.
Expand Down Expand Up @@ -321,22 +336,12 @@ swift:
You can also specify SWIFT DEVELOPMENT-SNAPSHOT as internal using swift version.
The format is same as [swiftenv version](https://swiftenv.fuller.li/en/latest/commands.html#version)

**EX.**
```
**e.g.**
```yaml
swift:
version: swift-4.0-DEVELOPMENT-SNAPSHOT-2017-08-04-a
```

## Extending Timeout Second
You can extend timeout within second that is described at `Integration Timeout` section in [API Gateway's developer guide](http://docs.aws.amazon.com/apigateway/latest/developerguide/limits.html#api-gateway-limits). Default is 10.
```
aws:
lambda:
timeout: 20
```
## Static Assets

You can also upload static assets.
Expand Down
1 change: 1 addition & 0 deletions Sources/HexavilleCore/HexavillefileLoader/AWSLoader.swift
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,7 @@ struct AWSLoader: PlatformConfigurationLoadable {
role: config["lambda"]["role"].string,
bucket: lambdaBucket,
timeout: config["lambda"]["timeout"].int ?? 10,
memory: Int32(config["lambda"]["memory"].int ?? 128),
vpcConfig: vpcConfig,
environment: environment
)
Expand Down
2 changes: 2 additions & 0 deletions Tests/HexavilleTests/HexavilefileLoaderTest.swift
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ class HexavilefileLoaderTest: XCTestCase {
str += " bucket: hexaville-test-app-8uh-bucket\n"
str += " role: arn:aws:iam::foo:role/lambda_basic_execution\n"
str += " timeout: 20\n"
str += " memory: 512\n"
str += " vpc:\n"
str += " subnetIds:\n"
str += " - subnet-foo-bar\n"
Expand Down Expand Up @@ -64,6 +65,7 @@ class HexavilefileLoaderTest: XCTestCase {
XCTAssertEqual(config.lambdaCodeConfig.bucket, "hexaville-test-app-8uh-bucket")
XCTAssertEqual(config.lambdaCodeConfig.role, "arn:aws:iam::foo:role/lambda_basic_execution")
XCTAssertEqual(config.lambdaCodeConfig.timeout, 20)
XCTAssertEqual(config.lambdaCodeConfig.memory, 512)
XCTAssertEqual(config.lambdaCodeConfig.vpcConfig!.subnetIds!, ["subnet-foo-bar", "subnet-bar-foo"])
XCTAssertEqual(config.lambdaCodeConfig.vpcConfig!.securityGroupIds!, ["sg-foo-bar", "sg-bar-foo"])
XCTAssertEqual(configuration.forSwift.version.asCompareableVersion(), SwiftVersion(major: 4, minor: 0))
Expand Down

0 comments on commit ed68dda

Please sign in to comment.