@steedos/service-package-registry 2.1.63 → 2.1.67

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.
Files changed (2) hide show
  1. package/package.json +3 -3
  2. package/package.service.js +18 -6
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@steedos/service-package-registry",
3
- "version": "2.1.63",
3
+ "version": "2.1.67",
4
4
  "description": "",
5
5
  "main": "package.service.js",
6
6
  "scripts": {
@@ -9,7 +9,7 @@
9
9
  "author": "",
10
10
  "license": "ISC",
11
11
  "dependencies": {
12
- "@steedos/service-package-loader": "2.1.63",
12
+ "@steedos/service-package-loader": "2.1.67",
13
13
  "fs-extra": "8.1.0",
14
14
  "i18next": "20.3.2",
15
15
  "json-stringify-safe": "5.0.1",
@@ -26,5 +26,5 @@
26
26
  "publishConfig": {
27
27
  "access": "public"
28
28
  },
29
- "gitHead": "899a7aa73130e62a9f53b80d5110e6e1b049962f"
29
+ "gitHead": "55195daf99312e32a604c8cb6ff8a37cb545824b"
30
30
  }
@@ -220,6 +220,12 @@ module.exports = {
220
220
  if(!user.is_space_admin){
221
221
  throw new Error('not permission!');
222
222
  }
223
+ try {
224
+ await this.loginSteedosRegistry();
225
+ console.info(`login steedos registry success`);
226
+ } catch (error) {
227
+ console.error(`login steedos registry fail: `, error.message);
228
+ }
223
229
  const result = await this.getCloudSaasPurchasedPackages();
224
230
  for (const _package of result.packages) {
225
231
  try {
@@ -268,6 +274,12 @@ module.exports = {
268
274
  if(!user.is_space_admin){
269
275
  throw new Error('not permission!');
270
276
  }
277
+ try {
278
+ await this.loginSteedosRegistry();
279
+ console.info(`login steedos registry success`);
280
+ } catch (error) {
281
+ console.error(`login steedos registry fail: `, error.message);
282
+ }
271
283
  let { module, version, url, auth, registry_url } = ctx.params
272
284
  const enable = true;
273
285
  return await this.installPackageFromUrl(module, version, url, auth, enable, registry_url, ctx.broker)
@@ -337,8 +349,8 @@ module.exports = {
337
349
  getCloudSaasPurchasedPackages:{
338
350
  async handler() {
339
351
  const settings = this.settings;
340
- const apiKey = settings.STEEDOS_CLOUD_API_KEY
341
- const spaceId = settings.STEEDOS_CLOUD_SPACE_ID
352
+ const apiKey = settings.STEEDOS_CLOUD_API_KEY || process.env.STEEDOS_CLOUD_API_KEY
353
+ const spaceId = settings.STEEDOS_CLOUD_SPACE_ID || process.env.STEEDOS_CLOUD_SPACE_ID
342
354
  const url = settings.STEEDOS_CLOUD_URL
343
355
 
344
356
  if(!apiKey || !spaceId || !url){
@@ -433,8 +445,8 @@ module.exports = {
433
445
 
434
446
  const settings = this.settings;
435
447
  if (url && url.startsWith(settings.STEEDOS_CLOUD_URL + '/api/pkg/download')) {
436
- const apiKey = settings.STEEDOS_CLOUD_API_KEY
437
- const spaceId = settings.STEEDOS_CLOUD_SPACE_ID
448
+ const apiKey = settings.STEEDOS_CLOUD_API_KEY || process.env.STEEDOS_CLOUD_API_KEY
449
+ const spaceId = settings.STEEDOS_CLOUD_SPACE_ID || process.env.STEEDOS_CLOUD_SPACE_ID
438
450
  const cloudUrl = settings.STEEDOS_CLOUD_URL
439
451
 
440
452
  if (!apiKey || !spaceId || !cloudUrl) {
@@ -513,8 +525,8 @@ module.exports = {
513
525
 
514
526
  // 初始化工作区数据
515
527
  // 获取环境变量中工作区信息
516
- const spaceId = settings.STEEDOS_CLOUD_SPACE_ID;
517
- const apiKey = settings.STEEDOS_CLOUD_API_KEY;
528
+ const spaceId = settings.STEEDOS_CLOUD_SPACE_ID || process.env.STEEDOS_CLOUD_SPACE_ID;
529
+ const apiKey = settings.STEEDOS_CLOUD_API_KEY || process.env.STEEDOS_CLOUD_API_KEY;
518
530
 
519
531
  if (!spaceId || !apiKey) {
520
532
  throw new Error('请配置环境变量STEEDOS_CLOUD_SPACE_ID和STEEDOS_CLOUD_API_KEY。');