@cloudbase/manager-node 4.1.1 → 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 +2 -1
- package/lib/env/index.js +8 -2
- package/lib/storage/index.js +8 -2
- package/package.json +1 -1
- package/types/constant.d.ts +1 -0
package/lib/constant.js
CHANGED
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
// static credentail = 'credential'
|
|
5
5
|
// }
|
|
6
6
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
7
|
-
exports.USE_INTERNAL_ENDPOINT = exports.SCF_STATUS = exports.ROLE_NAME = exports.PUBLIC_RSA_KEY = exports.ERROR = exports.SERVICE_TYPE = exports.ENDPOINT = exports.RUN_ENV = exports.SDK_VERSION = exports.ENV_NAME = void 0;
|
|
7
|
+
exports.COS_SDK_PROTOCOL = exports.USE_INTERNAL_ENDPOINT = exports.SCF_STATUS = exports.ROLE_NAME = exports.PUBLIC_RSA_KEY = exports.ERROR = exports.SERVICE_TYPE = exports.ENDPOINT = exports.RUN_ENV = exports.SDK_VERSION = exports.ENV_NAME = void 0;
|
|
8
8
|
exports.ENV_NAME = {
|
|
9
9
|
ENV_SECRETID: 'TENCENTCLOUD_SECRETID',
|
|
10
10
|
ENV_SECRETKEY: 'TENCENTCLOUD_SECRETKEY',
|
|
@@ -51,3 +51,4 @@ exports.SCF_STATUS = {
|
|
|
51
51
|
};
|
|
52
52
|
// 是否使用内网域名
|
|
53
53
|
exports.USE_INTERNAL_ENDPOINT = "USE_INTERNAL_ENDPOINT" in process.env;
|
|
54
|
+
exports.COS_SDK_PROTOCOL = process.env.COS_SDK_PROTOCOL;
|
package/lib/env/index.js
CHANGED
|
@@ -255,12 +255,18 @@ class EnvService {
|
|
|
255
255
|
}
|
|
256
256
|
getCos() {
|
|
257
257
|
const { secretId, secretKey, token } = this.environment.getAuthConfig();
|
|
258
|
-
|
|
258
|
+
const cosConfig = {
|
|
259
259
|
SecretId: secretId,
|
|
260
260
|
SecretKey: secretKey,
|
|
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) {
|
|
265
|
+
cosConfig.Protocol = constant_1.COS_SDK_PROTOCOL.endsWith(':')
|
|
266
|
+
? constant_1.COS_SDK_PROTOCOL.toLowerCase()
|
|
267
|
+
: constant_1.COS_SDK_PROTOCOL.toLowerCase() + ':';
|
|
268
|
+
}
|
|
269
|
+
return new cos_nodejs_sdk_v5_1.default(cosConfig);
|
|
264
270
|
}
|
|
265
271
|
getStorageConfig() {
|
|
266
272
|
var _a;
|
package/lib/storage/index.js
CHANGED
|
@@ -840,14 +840,20 @@ class StorageService {
|
|
|
840
840
|
getCos(parallel = 20) {
|
|
841
841
|
const { secretId, secretKey, token, proxy } = this.environment.getAuthConfig();
|
|
842
842
|
const cosProxy = process.env.TCB_COS_PROXY;
|
|
843
|
-
|
|
843
|
+
const cosConfig = {
|
|
844
844
|
FileParallelLimit: parallel,
|
|
845
845
|
SecretId: secretId,
|
|
846
846
|
SecretKey: secretKey,
|
|
847
847
|
Proxy: cosProxy || proxy,
|
|
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) {
|
|
852
|
+
cosConfig.Protocol = constant_1.COS_SDK_PROTOCOL.endsWith(':')
|
|
853
|
+
? constant_1.COS_SDK_PROTOCOL.toLowerCase()
|
|
854
|
+
: constant_1.COS_SDK_PROTOCOL.toLowerCase() + ':';
|
|
855
|
+
}
|
|
856
|
+
return new cos_nodejs_sdk_v5_1.default(cosConfig);
|
|
851
857
|
}
|
|
852
858
|
/**
|
|
853
859
|
* 将 cloudPath 转换成 cloudPath/ 形式
|
package/package.json
CHANGED
package/types/constant.d.ts
CHANGED