@cloudbase/manager-node 4.1.2 → 4.1.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.
package/lib/constant.js CHANGED
@@ -51,5 +51,4 @@ exports.SCF_STATUS = {
51
51
  };
52
52
  // 是否使用内网域名
53
53
  exports.USE_INTERNAL_ENDPOINT = "USE_INTERNAL_ENDPOINT" in process.env;
54
- // 允许通过环境变量指定 COS SDK 的协议为 HTTPS 或 HTTP
55
- exports.COS_SDK_PROTOCOL = "COS_SDK_PROTOCOL";
54
+ exports.COS_SDK_PROTOCOL = process.env.COS_SDK_PROTOCOL;
package/lib/env/index.js CHANGED
@@ -261,8 +261,10 @@ class EnvService {
261
261
  SecurityToken: token,
262
262
  Domain: constant_1.USE_INTERNAL_ENDPOINT ? "{Bucket}.cos-internal.{Region}.tencentcos.cn" /* INTERNAL */ : "{Bucket}.cos.{Region}.tencentcos.cn" /* PUBLIC */
263
263
  };
264
- if (constant_1.COS_SDK_PROTOCOL in process.env && process.env.COS_SDK_PROTOCOL.toLowerCase().startsWith('http')) {
265
- cosConfig.Protocol = process.env.COS_SDK_PROTOCOL.toLowerCase() + ":";
264
+ if (constant_1.COS_SDK_PROTOCOL) {
265
+ cosConfig.Protocol = constant_1.COS_SDK_PROTOCOL.endsWith(':')
266
+ ? constant_1.COS_SDK_PROTOCOL.toLowerCase()
267
+ : constant_1.COS_SDK_PROTOCOL.toLowerCase() + ':';
266
268
  }
267
269
  return new cos_nodejs_sdk_v5_1.default(cosConfig);
268
270
  }
@@ -848,8 +848,10 @@ class StorageService {
848
848
  SecurityToken: token,
849
849
  Domain: constant_1.USE_INTERNAL_ENDPOINT ? "{Bucket}.cos-internal.{Region}.tencentcos.cn" /* INTERNAL */ : "{Bucket}.cos.{Region}.tencentcos.cn" /* PUBLIC */
850
850
  };
851
- if (constant_1.COS_SDK_PROTOCOL in process.env && process.env.COS_SDK_PROTOCOL.toLowerCase().startsWith('http')) {
852
- cosConfig.Protocol = process.env.COS_SDK_PROTOCOL.toLowerCase() + ":";
851
+ if (constant_1.COS_SDK_PROTOCOL) {
852
+ cosConfig.Protocol = constant_1.COS_SDK_PROTOCOL.endsWith(':')
853
+ ? constant_1.COS_SDK_PROTOCOL.toLowerCase()
854
+ : constant_1.COS_SDK_PROTOCOL.toLowerCase() + ':';
853
855
  }
854
856
  return new cos_nodejs_sdk_v5_1.default(cosConfig);
855
857
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@cloudbase/manager-node",
3
- "version": "4.1.2",
3
+ "version": "4.1.3",
4
4
  "description": "The node manage service api for cloudbase.",
5
5
  "main": "lib/index.js",
6
6
  "scripts": {
@@ -40,4 +40,4 @@ export declare const enum COS_ENDPOINT {
40
40
  INTERNAL = "{Bucket}.cos-internal.{Region}.tencentcos.cn",
41
41
  PUBLIC = "{Bucket}.cos.{Region}.tencentcos.cn"
42
42
  }
43
- export declare const COS_SDK_PROTOCOL = "COS_SDK_PROTOCOL";
43
+ export declare const COS_SDK_PROTOCOL: string;