|
| 1 | +import { WebServerImageDefaultPort } from './constants'; |
1 | 2 | import { ScfCreateFunctionInputs, BaseFunctionConfig, ProtocolParams } from './interface';
|
2 | 3 | const CONFIGS = require('./config').default;
|
3 | 4 |
|
@@ -52,6 +53,20 @@ export const formatInputs = (inputs: ScfCreateFunctionInputs) => {
|
52 | 53 | if (imageConfig.args) {
|
53 | 54 | functionInputs.Code!.ImageConfig!.Args = imageConfig.args;
|
54 | 55 | }
|
| 56 | + // 镜像加速 |
| 57 | + if (imageConfig.containerImageAccelerate !== undefined) { |
| 58 | + functionInputs.Code!.ImageConfig!.ContainerImageAccelerate = |
| 59 | + imageConfig.containerImageAccelerate; |
| 60 | + } |
| 61 | + // 监听端口: -1 表示 job镜像,0 ~ 65526 表示webServer镜像 |
| 62 | + if (imageConfig.imagePort) { |
| 63 | + functionInputs.Code!.ImageConfig!.ImagePort = |
| 64 | + Number.isInteger(imageConfig?.imagePort) && |
| 65 | + imageConfig?.imagePort >= -1 && |
| 66 | + imageConfig?.imagePort <= 65535 |
| 67 | + ? imageConfig.imagePort |
| 68 | + : WebServerImageDefaultPort; |
| 69 | + } |
55 | 70 | } else {
|
56 | 71 | // 基于 COS 代码部署
|
57 | 72 | functionInputs.Code = {
|
@@ -149,7 +164,7 @@ export const formatInputs = (inputs: ScfCreateFunctionInputs) => {
|
149 | 164 | inputs.cfs.forEach((item) => {
|
150 | 165 | functionInputs.CfsConfig?.CfsInsList.push({
|
151 | 166 | CfsId: item.cfsId,
|
152 |
| - MountInsId: item.MountInsId || item.cfsId, |
| 167 | + MountInsId: item.mountInsId || item.MountInsId || item.cfsId, |
153 | 168 | LocalMountDir: item.localMountDir,
|
154 | 169 | RemoteMountDir: item.remoteMountDir,
|
155 | 170 | UserGroupId: String(item.userGroupId || 10000),
|
|
0 commit comments