Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions bin/node-lambda
Original file line numberDiff line numberDiff line change
Expand Up@@ -37,6 +37,7 @@ const AWS_FUNCTION_VERSION = process.env.AWS_FUNCTION_VERSION || ''
const AWS_VPC_SUBNETS = process.env.AWS_VPC_SUBNETS || ''
const AWS_VPC_SECURITY_GROUPS = process.env.AWS_VPC_SECURITY_GROUPS || ''
const AWS_TRACING_CONFIG = process.env.AWS_TRACING_CONFIG || ''
const AWS_LAYERS = process.env.AWS_LAYERS || ''
const AWS_LOGS_RETENTION_IN_DAYS = process.env.AWS_LOGS_RETENTION_IN_DAYS || ''
const EVENT_FILE = process.env.EVENT_FILE || 'event.json'
const PACKAGE_DIRECTORY = process.env.PACKAGE_DIRECTORY
Expand DownExpand Up@@ -90,6 +91,7 @@ program
AWS_DLQ_TARGET_ARN)
.option('-c, --tracingConfig [AWS_TRACING_CONFIG]', 'Lambda tracing settings',
AWS_TRACING_CONFIG)
.option('-l, --layers [AWS_LAYERS]', 'Lambda Layers settings', AWS_LAYERS)
.option('-R, --retentionInDays [AWS_LOGS_RETENTION_IN_DAYS]', 'CloudWatchLogs retentionInDays settings',
AWS_LOGS_RETENTION_IN_DAYS)
.option('-A, --packageDirectory [PACKAGE_DIRECTORY]', 'Local Package Directory', PACKAGE_DIRECTORY)
Expand Down
9 changes: 7 additions & 2 deletions lib/main.js
Original file line numberDiff line numberDiff line change
Expand Up@@ -215,7 +215,8 @@ so you can easily test run multiple events.
},
TracingConfig: {
Mode: null
}
},
Layers: []
}

if (this._isUseS3(program)) {
Expand DownExpand Up@@ -252,6 +253,9 @@ so you can easily test run multiple events.
if (program.tracingConfig) {
params.TracingConfig.Mode = program.tracingConfig
}
if (program.layers) {
params.Layers = program.layers.split(',')
}

return params
}
Expand DownExpand Up@@ -538,7 +542,8 @@ so you can easily test run multiple events.
'Environment': params.Environment,
'KMSKeyArn': params.KMSKeyArn,
'DeadLetterConfig': params.DeadLetterConfig,
'TracingConfig': params.TracingConfig
'TracingConfig': params.TracingConfig,
'Layers': params.Layers
}, (err, data) => {
if (err) return reject(err)
resolve(data)
Expand Down
13 changes: 13 additions & 0 deletions test/main.js
Original file line numberDiff line numberDiff line change
Expand Up@@ -23,6 +23,7 @@ const originalProgram = {
runtime: 'nodejs8.10',
deadLetterConfigTargetArn: '',
tracingConfig: '',
Layers: '',
retentionInDays: 30,
region: 'us-east-1,us-west-2,eu-west-1',
eventFile: 'event.json',
Expand DownExpand Up@@ -298,6 +299,18 @@ describe('lib/main', function () {
assert.isNull(params.TracingConfig.Mode)
})

it('appends Layers to params when params set', () => {
program.layers = 'Layer1,Layer2'
const params = lambda._params(program)
assert.deepEqual(params.Layers, ['Layer1', 'Layer2'])
})

it('does not append Layers when params are not set', () => {
program.layers = ''
const params = lambda._params(program)
assert.deepEqual(params.Layers, [])
})

describe('S3 deploy', () => {
it('Do not use S3 deploy', () => {
const params = lambda._params(program, 'Buffer')
Expand Down