serverless-leo
Advanced tools
Comparing version 1.3.15 to 1.3.16
@@ -59,2 +59,3 @@ 'use strict' | ||
const prefix = config && config.prefix ? `${config.prefix}` : undefined | ||
const suffix = config && config.suffix ? `${config.suffix}` : undefined | ||
const botPrefix = prefix ? `${prefix}-` : '' | ||
@@ -65,3 +66,3 @@ const sourceQueue = config ? config.queue : leoEvent.leo | ||
let botId | ||
let botSuffix = botNumber > 0 ? '-' + botNumber : '' | ||
let botSuffix = suffix ? `-${suffix}` : botNumber > 0 ? '-' + botNumber : '' | ||
// If there is no botPrefix, no source queue and multiple bots: add the eventIndex to the botSuffix (botId ultimately) | ||
@@ -81,3 +82,4 @@ if (!botPrefix && !sourceQueue && leoEvents.length > 1) { | ||
botNumber, | ||
prefix | ||
prefix, | ||
suffix | ||
}, | ||
@@ -84,0 +86,0 @@ lambdaName: { |
{ | ||
"name": "serverless-leo", | ||
"version": "1.3.15", | ||
"version": "1.3.16", | ||
"description": "Serverless plugin for leo microservices", | ||
@@ -5,0 +5,0 @@ "main": "index.js", |
@@ -18,2 +18,9 @@ # serverless-leo | ||
## Migrate an existing leo microservice to serverless | ||
Copy the migrateToServerless.js file into your existing microservice directory. | ||
``` | ||
node migrateToServerless.js | ||
``` | ||
See additional notes within the migrateToServerless.js script. | ||
## Create a new NodeJS Leo Microservice and Bot | ||
@@ -20,0 +27,0 @@ ``` |
@@ -187,2 +187,26 @@ 'use strict' | ||
}) | ||
it('names the bot using the suffix in config in events', async () => { | ||
const sls = testServerless() | ||
const lambda = cloneDeep(helloNodeWorldLambda) | ||
lambda.events = [ | ||
{ | ||
'leo': { | ||
'queue': 'test_hello', | ||
'suffix': 'dest_queue' | ||
} | ||
}, | ||
{ | ||
'leo': { | ||
'cron': '* * * * * *', | ||
'prefix': 'prename2' | ||
} | ||
} | ||
] | ||
sls.serverless.service.functions.helloNodeWorld = lambda | ||
await sls.compileLeo() | ||
expect(sls.serverless.service.provider.compiledCloudFormationTemplate.Resources['LeoRegister0'] | ||
.Properties).to.haveOwnProperty('hello-serverless-leo-world-dev-test_hello-helloNodeWorld-dest_queue') | ||
expect(sls.serverless.service.provider.compiledCloudFormationTemplate.Resources['LeoRegister0'] | ||
.Properties['hello-serverless-leo-world-dev-prename2-helloNodeWorld'].name).to.equal('prename2-helloNodeWorld') | ||
}) | ||
it('names the bot using lambda name if there is only one cron event', async () => { | ||
@@ -189,0 +213,0 @@ const sls = testServerless() |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
Dynamic require
Supply chain riskDynamic require can indicate the package is performing dangerous or unsafe dynamic code execution.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
51340
17
1122
135
9