@be-link/cos 1.12.11 → 1.12.12
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/bin/upload.js +12 -12
- package/package.json +1 -1
package/bin/upload.js
CHANGED
|
@@ -118,21 +118,21 @@ async function initCOS() {
|
|
|
118
118
|
console.warn('⚠️ 临时密钥获取失败:', err.message);
|
|
119
119
|
console.warn('⚠️ 尝试使用环境变量 COS_SECRET_ID 和 COS_SECRET_KEY');
|
|
120
120
|
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
121
|
+
const secretId = process.env.COS_SECRET_ID;
|
|
122
|
+
const secretKey = process.env.COS_SECRET_KEY;
|
|
123
|
+
|
|
124
|
+
if (!secretId || !secretKey) {
|
|
125
|
+
console.error('❌ 错误:未找到 COS 密钥配置');
|
|
126
|
+
console.error(' 请设置环境变量:');
|
|
127
|
+
console.error(' - COS_SECRET_ID');
|
|
128
|
+
console.error(' - COS_SECRET_KEY');
|
|
129
|
+
process.exit(1);
|
|
130
|
+
}
|
|
131
131
|
|
|
132
132
|
console.log('✅ 使用环境变量中的密钥');
|
|
133
133
|
cos = new COS({
|
|
134
|
-
SecretId:
|
|
135
|
-
SecretKey:
|
|
134
|
+
SecretId: secretId,
|
|
135
|
+
SecretKey: secretKey,
|
|
136
136
|
});
|
|
137
137
|
|
|
138
138
|
return cos;
|