@cloudbase/manager-node 4.2.2 → 4.2.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -839,13 +839,14 @@ class StorageService {
839
839
  getCos(parallel = 20) {
840
840
  const { secretId, secretKey, token, proxy } = this.environment.getAuthConfig();
841
841
  const cosProxy = process.env.TCB_COS_PROXY;
842
- return new cos_nodejs_sdk_v5_1.default({
843
- FileParallelLimit: parallel,
844
- SecretId: secretId,
845
- SecretKey: secretKey,
846
- Proxy: cosProxy || proxy,
847
- SecurityToken: token
848
- });
842
+ const useCosInternalDomain = !!process.env.USE_COS_INTERNAL_DOMAIN;
843
+ return new cos_nodejs_sdk_v5_1.default(Object.assign({ FileParallelLimit: parallel, SecretId: secretId, SecretKey: secretKey, Proxy: cosProxy || proxy, SecurityToken: token }, (useCosInternalDomain
844
+ ? {
845
+ Domain: '{Bucket}.cos-internal.{Region}.tencentcos.cn',
846
+ ServiceDomain: 'service.cos.tencentcos.cn',
847
+ Protocol: 'http:'
848
+ }
849
+ : {})));
849
850
  }
850
851
  /**
851
852
  * 将 cloudPath 转换成 cloudPath/ 形式
@@ -919,7 +920,8 @@ class StorageService {
919
920
  times: times - 1,
920
921
  interval,
921
922
  failedFiles: tempFailedFiles
922
- }).then(res => resolve(res))
923
+ })
924
+ .then(res => resolve(res))
923
925
  .catch(err => reject(err)), interval);
924
926
  });
925
927
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@cloudbase/manager-node",
3
- "version": "4.2.2",
3
+ "version": "4.2.3",
4
4
  "description": "The node manage service api for cloudbase.",
5
5
  "main": "lib/index.js",
6
6
  "scripts": {
@@ -1137,13 +1137,21 @@ export class StorageService {
1137
1137
  private getCos(parallel = 20) {
1138
1138
  const { secretId, secretKey, token, proxy } = this.environment.getAuthConfig()
1139
1139
  const cosProxy = process.env.TCB_COS_PROXY
1140
+ const useCosInternalDomain = !!process.env.USE_COS_INTERNAL_DOMAIN
1140
1141
 
1141
1142
  return new COS({
1142
1143
  FileParallelLimit: parallel,
1143
1144
  SecretId: secretId,
1144
1145
  SecretKey: secretKey,
1145
1146
  Proxy: cosProxy || proxy,
1146
- SecurityToken: token
1147
+ SecurityToken: token,
1148
+ ...(useCosInternalDomain
1149
+ ? {
1150
+ Domain: '{Bucket}.cos-internal.{Region}.tencentcos.cn',
1151
+ ServiceDomain: 'service.cos.tencentcos.cn',
1152
+ Protocol: 'http:'
1153
+ }
1154
+ : {})
1147
1155
  })
1148
1156
  }
1149
1157
 
@@ -1229,7 +1237,8 @@ export class StorageService {
1229
1237
  times: times - 1,
1230
1238
  interval,
1231
1239
  failedFiles: tempFailedFiles
1232
- }).then(res => resolve(res))
1240
+ })
1241
+ .then(res => resolve(res))
1233
1242
  .catch(err => reject(err)),
1234
1243
  interval
1235
1244
  )