Skip to content

Commit

Permalink
Merge pull request #1 from yugasun/fix/apigw-namespace
Browse files Browse the repository at this point in the history
fix: apigw namespace
  • Loading branch information
anycodes authored Mar 12, 2020
2 parents 97da2f9 + 11ef379 commit a58b258
Show file tree
Hide file tree
Showing 5 changed files with 19 additions and 14 deletions.
1 change: 1 addition & 0 deletions .eslintignore
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
coverage
dist
node_modules
component
1 change: 1 addition & 0 deletions .prettierignore
Original file line number Diff line number Diff line change
Expand Up @@ -21,3 +21,4 @@ env.js
package-lock.json
yarn.lock
CHANGELOG.md
component
20 changes: 10 additions & 10 deletions docs/configure.md
Original file line number Diff line number Diff line change
Expand Up @@ -43,16 +43,16 @@ pyramid:
Main param description
| Param | Required/Optional | Default | Description |
| --------------------------------------------------- | :---------------: | :----------: | :------------------------------------------------------------------------------------------ |
| region | Optional | ap-guangzhou | |
| pyramidProjectName | Required | | Pyramid Projct Name |
| functionName | Optional | | ServerlessCloudFunction Name |
| serviceName | Optional | | API-Gateway service name, default to create a new serivce |
| serviceId | Optional | | API-Gateway service id, if it has will use this APII-Gateway service |
| code | Optional | | Default is current working directory |
| [functionConf](#funtionConf-param-description) | Optional | | Function configure |
| [apigatewayConf](#apigatewayConf-param-description) | Optional | | API-Gateway configure |
| Param | Required/Optional | Default | Description |
| --------------------------------------------------- | :---------------: | :----------: | :------------------------------------------------------------------- |
| region | Optional | ap-guangzhou | |
| pyramidProjectName | Required | | Pyramid Projct Name |
| functionName | Optional | | ServerlessCloudFunction Name |
| serviceName | Optional | | API-Gateway service name, default to create a new serivce |
| serviceId | Optional | | API-Gateway service id, if it has will use this APII-Gateway service |
| code | Optional | | Default is current working directory |
| [functionConf](#funtionConf-param-description) | Optional | | Function configure |
| [apigatewayConf](#apigatewayConf-param-description) | Optional | | API-Gateway configure |
### funtionConf param description
Expand Down
4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -47,8 +47,8 @@
},
"dependencies": {
"@serverless/core": "^1.1.1",
"@serverless/tencent-apigateway": "^2.0.4",
"@serverless/tencent-scf": "^2.0.9",
"@serverless/tencent-apigateway": "^2.1.4",
"@serverless/tencent-scf": "^3.0.0",
"ext": "^1.4.0",
"type": "^2.0.0"
},
Expand Down
7 changes: 5 additions & 2 deletions serverless.js
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,7 @@ class TencentPyramid extends Component {
`PyramidComponent_${random({ length: 6 })}`
inputs.codeUri = ensureString(inputs.code, { isOptional: true }) || process.cwd()
inputs.region = ensureString(inputs.region, { default: 'ap-guangzhou' })
inputs.namespace = ensureString(inputs.namespace, { default: 'default' })
inputs.include = ensureIterable(inputs.include, { default: [], ensureItem: ensureString })
inputs.exclude = ensureIterable(inputs.exclude, { default: [], ensureItem: ensureString })
inputs.apigatewayConf = ensurePlainObject(inputs.apigatewayConf, { default: {} })
Expand Down Expand Up @@ -114,10 +115,12 @@ class TencentPyramid extends Component {
method: 'ANY',
function: {
isIntegratedResponse: true,
functionName: tencentCloudFunctionOutputs.Name
functionName: tencentCloudFunctionOutputs.Name,
functionNamespace: inputs.namespace
}
}
]
],
customDomain: inputs.apigatewayConf.customDomain
}

if (inputs.apigatewayConf && inputs.apigatewayConf.auth) {
Expand Down

0 comments on commit a58b258

Please sign in to comment.