Skip to content

Commit

Permalink
Merge 34c1184 into 0b7ef7e
Browse files Browse the repository at this point in the history
  • Loading branch information
juanjoDiaz committed Jan 25, 2019
2 parents 0b7ef7e + 34c1184 commit a3e55bc
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 0 deletions.
2 changes: 2 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -122,6 +122,7 @@ functions:
* **name** (default `${service}-${stage}-warmup-plugin`)
* **role** (default to role in the provider)
* **tags** (default to serverless default tags)
* **vpc** (default to vpc in provider, can be set to `false` to deploy the warmup function outside of VPC)
* **schedule** (default `rate(5 minutes)`) - More examples [here](https://docs.aws.amazon.com/lambda/latest/dg/tutorial-scheduled-events-schedule-expressions.html).
* **memorySize** (default `128`)
* **timeout** (default `10` seconds)
Expand All @@ -146,6 +147,7 @@ custom:
tags:
Project: foo
Owner: bar
vpc: false
schedule: 'cron(0/5 8-17 ? * MON-FRI *)' // Run WarmUP every 5 minutes Mon-Fri between 8:00am and 5:55pm (UTC)
timeout: 20
prewarm: true // Run WarmUp immediately after a deploymentlambda
Expand Down
6 changes: 6 additions & 0 deletions src/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -111,6 +111,8 @@ class WarmUP {
name: (typeof config.name === 'string') ? config.name : defaultOpts.name,
role: (typeof config.role === 'string') ? config.role : defaultOpts.role,
tags: (typeof config.tags === 'object') ? config.tags : defaultOpts.tags,
vpc: config.vpc === false ? { securityGroupIds: [], subnetIds: [] }
: (typeof config.vpc === 'object' ? config.vpc : defaultOpts.vpc),
schedule: (typeof config.schedule === 'string') ? [config.schedule]
: (Array.isArray(config.schedule)) ? config.schedule : defaultOpts.schedule,
memorySize: (typeof config.memorySize === 'number') ? config.memorySize : defaultOpts.memorySize,
Expand Down Expand Up @@ -316,6 +318,10 @@ module.exports.warmUp = async (event, context, callback) => {
this.serverless.service.functions.warmUpPlugin.tags = this.warmupOpts.tags
}

if (this.warmupOpts.vpc) {
this.serverless.service.functions.vpc = this.warmupOpts.vpc
}

/** Return service function object */
return this.serverless.service.functions.warmUpPlugin
}
Expand Down

0 comments on commit a3e55bc

Please sign in to comment.