From 207df8801674edbfaf5b6068c5d8e3d0cc26fb74 Mon Sep 17 00:00:00 2001 From: Erica Windisch <73207+ewindisch@users.noreply.github.com> Date: Mon, 5 Aug 2019 06:30:15 -0700 Subject: [PATCH] Allow override of layer arn Signed-off-by: Erica Windisch <73207+ewindisch@users.noreply.github.com> --- README.md | 6 +++++- src/index.ts | 3 ++- 2 files changed, 7 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index bc84052..67c2da8 100644 --- a/README.md +++ b/README.md @@ -80,6 +80,10 @@ config: - another-excluded-func ``` +#### `layer_arn` (optional) + +Pin to a specific layer version. The latest layer ARN is automatically fetched from the [IOpipe Layers API](https://layers.iopipe.com) + #### `prepend` (optional) Whether or not to prepend the IOpipe layer. Defaults to `false` which appends the layer. @@ -116,4 +120,4 @@ When using with the [Serverless Enterprise Plugin](https://github.com/serverless ## License -Apache 2.0 \ No newline at end of file +Apache 2.0 diff --git a/src/index.ts b/src/index.ts index 5f74172..1fd1134 100644 --- a/src/index.ts +++ b/src/index.ts @@ -126,7 +126,8 @@ export default class IOpipeLayerPlugin { return; } - const layerArn = await this.getLayerArn(runtime, region); + const layerArn = this.config.layer_arn ? this.config.layer_arn : await this.getLayerArn(runtime, region); + const iopipeLayers = layers.filter( layer => typeof layer === "string" && layer.match(layerArn) );