Skip to content

Commit aaf8ca1

Browse files
committed
fix: support eip config
1 parent e5eaa6a commit aaf8ca1

File tree

4 files changed

+26
-32
lines changed

4 files changed

+26
-32
lines changed

docs/configure.md

+22-20
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,7 @@ inputs:
3232
version: 1 # 版本
3333
functionConf: # 函数配置相关
3434
timeout: 10 # 超时时间,单位秒
35+
eip: false # 是否固定出口IP
3536
memorySize: 128 # 内存大小,单位MB
3637
environment: # 环境变量
3738
variables: # 环境变量数组
@@ -76,8 +77,8 @@ inputs:
7677
7778
| 参数名称 | 是否必选 | 默认值 | 描述 |
7879
| ------------------------------------ | :------: | :-------------: | :------------------------------------------------------------- |
79-
| runtime | 否 | Python3.6 | 执行环境, 目前支持: Python3.6, Python2.7 |
80-
| region | 否 | ap-guangzhou | 项目部署所在区域,默认广州区 |
80+
| runtime | 否 | `Python3.6` | 执行环境, 目前支持: Python3.6, Python2.7 |
81+
| region | 否 | `ap-guangzhou` | 项目部署所在区域,默认广州区 |
8182
| functionName | 否 | | 云函数名称 |
8283
| serviceName | 否 | | API 网关服务名称, 默认创建一个新的服务名称 |
8384
| serviceId | 否 | | API 网关服务 ID,如果存在将使用这个 API 网关服务 |
@@ -110,7 +111,7 @@ inputs:
110111

111112
| 参数名称 | 是否必选 | 类型 | 默认值 | 描述 |
112113
| ---------- | :------: | -------- | :----: | :---------------------------------------------- |
113-
| ttl | 否 | Number | 600 | TTL 值,范围 1 - 604800,不同等级域名最小值不同 |
114+
| ttl | 否 | Number | `600` | TTL 值,范围 1 - 604800,不同等级域名最小值不同 |
114115
| recordLine | 否 | String[] | | 记录的线路名称 |
115116

116117
### 指定区配置
@@ -125,12 +126,13 @@ inputs:
125126

126127
参考: https://cloud.tencent.com/document/product/583/18586
127128

128-
| 参数名称 | 是否必选 | 类型 | 默认值 | 描述 |
129-
| ----------- | :------: | :----: | :----: | :------------------------------------------------------------------------------ |
130-
| timeout | 否 | Number | 3 | 函数最长执行时间,单位为秒,可选值范围 1-900 秒,默认为 3 秒 |
131-
| memorySize | 否 | Number | 128 | 函数运行时内存大小,默认为 128M,可选范围 64、128MB-3072MB,并且以 128MB 为阶梯 |
132-
| environment | 否 | Object | | 函数的环境变量, 参考 [环境变量](#环境变量) |
133-
| vpcConfig | 否 | Object | | 函数的 VPC 配置, 参考 [VPC 配置](#VPC-配置) |
129+
| 参数名称 | 是否必选 | 类型 | 默认值 | 描述 |
130+
| ----------- | :------: | :-----: | :-----: | :------------------------------------------------------------------------------ |
131+
| timeout | 否 | Number | `3` | 函数最长执行时间,单位为秒,可选值范围 1-900 秒,默认为 3 秒 |
132+
| memorySize | 否 | Number | `128` | 函数运行时内存大小,默认为 128M,可选范围 64、128MB-3072MB,并且以 128MB 为阶梯 |
133+
| environment | 否 | Object | | 函数的环境变量, 参考 [环境变量](#环境变量) |
134+
| vpcConfig | 否 | Object | | 函数的 VPC 配置, 参考 [VPC 配置](#VPC-配置) |
135+
| eip | 否 | Boolean | `false` | 是否固定出口 IP |
134136

135137
##### 环境变量
136138

@@ -147,16 +149,16 @@ inputs:
147149

148150
### API 网关配置
149151

150-
| 参数名称 | 是否必选 | 类型 | 默认值 | 描述 |
151-
| -------------- | :------: | :------- | :------- | :--------------------------------------------------------------------------------- |
152-
| protocols | 否 | String[] | ['http'] | 前端请求的类型,如 http,https,http 与 https |
153-
| environment | 否 | String | release | 发布环境. 目前支持三种发布环境: test(测试), prepub(预发布) 与 release(发布). |
154-
| usagePlan | 否 | | | 使用计划配置, 参考 [使用计划](#使用计划) |
155-
| auth | 否 | | | API 密钥配置, 参考 [API 密钥](#API-密钥配置) |
156-
| customDomain | 否 | Object[] | | 自定义 API 域名配置, 参考 [自定义域名](#自定义域名) |
157-
| enableCORS | 否 | Boolean | `false` | 开启跨域。默认值为否。 |
158-
| serviceTimeout | 否 | Number | `15` | Api 超时时间,单位: 秒 |
159-
| isDisabled | 否 | Boolean | `false` | 关闭自动创建 API 网关功能。默认值为否,即默认自动创建 API 网关。 |
152+
| 参数名称 | 是否必选 | 类型 | 默认值 | 描述 |
153+
| -------------- | :------: | :------- | :--------- | :--------------------------------------------------------------------------------- |
154+
| protocols | 否 | String[] | `['http']` | 前端请求的类型,如 http,https,http 与 https |
155+
| environment | 否 | String | `release` | 发布环境. 目前支持三种发布环境: test(测试), prepub(预发布) 与 release(发布). |
156+
| usagePlan | 否 | | | 使用计划配置, 参考 [使用计划](#使用计划) |
157+
| auth | 否 | | | API 密钥配置, 参考 [API 密钥](#API-密钥配置) |
158+
| customDomain | 否 | Object[] | | 自定义 API 域名配置, 参考 [自定义域名](#自定义域名) |
159+
| enableCORS | 否 | Boolean | `false` | 开启跨域。默认值为否。 |
160+
| serviceTimeout | 否 | Number | `15` | Api 超时时间,单位: 秒 |
161+
| isDisabled | 否 | Boolean | `false` | 关闭自动创建 API 网关功能。默认值为否,即默认自动创建 API 网关。 |
160162

161163
##### 使用计划
162164

@@ -186,7 +188,7 @@ Refer to: https://cloud.tencent.com/document/product/628/14906
186188
| ---------------- | :------: | :------: | :----: | :----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
187189
| domain | 是 | String | | 待绑定的自定义的域名。 |
188190
| certificateId | 否 | String | | 待绑定自定义域名的证书唯一 ID,如果设置了 type 为 https,则为必选 |
189-
| isDefaultMapping | 否 | String | `true` | 是否使用默认路径映射,默认为 true。为 false 时,表示自定义路径映射,此时 pathMappingSet 必填。 |
191+
| isDefaultMapping | 否 | String | `true` | 是否使用默认路径映射。为 false 时,表示自定义路径映射,此时 pathMappingSet 必填。 |
190192
| pathMappingSet | 否 | Object[] | `[]` | 自定义路径映射的路径。使用自定义映射时,可一次仅映射一个 path 到一个环境,也可映射多个 path 到多个环境。并且一旦使用自定义映射,原本的默认映射规则不再生效,只有自定义映射路径生效。 |
191193
| protocol | 否 | String[] | | 绑定自定义域名的协议类型,默认与服务的前端协议一致。 |
192194

src/config.js

-1
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,6 @@ const CONFIGS = {
44
compFullname: 'Flask',
55
handler: 'sl_handler.handler',
66
runtime: 'Python3.6',
7-
exclude: ['.git/**', '.gitignore', '.DS_Store'],
87
timeout: 3,
98
memorySize: 128,
109
namespace: 'default',

src/package.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
{
22
"dependencies": {
33
"download": "^8.0.0",
4-
"tencent-component-toolkit": "^1.13.0",
4+
"tencent-component-toolkit": "^1.13.2",
55
"type": "^2.0.0"
66
}
77
}

src/utils.js

+3-10
Original file line numberDiff line numberDiff line change
@@ -251,7 +251,9 @@ const prepareInputs = async (instance, credentials, inputs = {}) => {
251251
}),
252252
publish: inputs.publish,
253253
traffic: inputs.traffic,
254-
lastVersion: instance.state.lastVersion
254+
lastVersion: instance.state.lastVersion,
255+
eip: tempFunctionConf.eip === true,
256+
l5Enable: tempFunctionConf.l5Enable === true
255257
}
256258

257259
// validate traffic
@@ -264,15 +266,6 @@ const prepareInputs = async (instance, credentials, inputs = {}) => {
264266
default: null
265267
})
266268

267-
functionConf.include = ensureIterable(
268-
tempFunctionConf.include ? tempFunctionConf.include : inputs.include,
269-
{ default: [], ensureItem: ensureString }
270-
)
271-
functionConf.exclude = ensureIterable(
272-
tempFunctionConf.exclude ? tempFunctionConf.exclude : inputs.exclude,
273-
{ default: [], ensureItem: ensureString }
274-
)
275-
functionConf.exclude.push('.git/**', '.gitignore', '.serverless', '.DS_Store')
276269
if (inputs.functionConf) {
277270
functionConf.timeout = inputs.functionConf.timeout
278271
? inputs.functionConf.timeout

0 commit comments

Comments
 (0)