Skip to content

Commit

Permalink
fix: function name regex
Browse files Browse the repository at this point in the history
  • Loading branch information
yugasun committed Aug 14, 2020
1 parent 45e62fc commit 53a4078
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 7 deletions.
4 changes: 2 additions & 2 deletions serverless.component.yml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
name: scf
version: 0.1.0
version: 0.1.2
author: Tencent Cloud, Inc.
org: Tencent Cloud, Inc.
description: Deploy a serverless cloud function on Tencent Cloud.
Expand All @@ -21,7 +21,7 @@ actions:
name:
type: string
description: The name of Tencent SCF function.
regex: '^[a-z][a-z0-9\-]{0,61}[A-Za-z0-9]$'
regex: '^[A-Za-z][\w-_]{0,58}[A-Za-z0-9]$'
handler:
type: string
default: 'index.main_handler'
Expand Down
20 changes: 15 additions & 5 deletions src/serverless.js
Original file line number Diff line number Diff line change
Expand Up @@ -90,11 +90,21 @@ class ServerlessComponent extends Component {
if (apigwTrigger.serviceId) {
stateApigw[apigwTrigger.serviceName] = apigwTrigger.serviceId
apigwTrigger.apiList.forEach((endpoint) => {
triggers['apigw'].push(
`${this.getDefaultProtocol(apigwTrigger.protocols)}://${apigwTrigger.subDomain}/${
apigwTrigger.environment
}${endpoint.path}`
)
if (typeof apigwTrigger.subDomain !== 'string') {
apigwTrigger.subDomain.forEach((item) => {
triggers['apigw'].push(
`${this.getDefaultProtocol(apigwTrigger.protocols)}://${item}/${
apigwTrigger.environment
}${endpoint.path}`
)
})
} else {
triggers['apigw'].push(
`${this.getDefaultProtocol(apigwTrigger.protocols)}://${apigwTrigger.subDomain}/${
apigwTrigger.environment
}${endpoint.path}`
)
}
})
}
})
Expand Down

0 comments on commit 53a4078

Please sign in to comment.