diff --git a/app/apps/server/communication/rest.js b/app/apps/server/communication/rest.js index 0bbf95ecb472..bd8f3531279d 100644 --- a/app/apps/server/communication/rest.js +++ b/app/apps/server/communication/rest.js @@ -53,7 +53,7 @@ export class AppsRestApi { this.api.addRoute('', { authRequired: true, permissionsRequired: ['manage-apps'] }, { get() { - const baseUrl = settings.get('Apps_Framework_Marketplace_Url'); + const baseUrl = orchestrator.getMarketplaceUrl(); // Gets the Apps from the marketplace if (this.queryParams.marketplace) { @@ -123,7 +123,7 @@ export class AppsRestApi { buff = Buffer.from(result.content, 'binary'); } else if (this.bodyParams.appId && this.bodyParams.marketplace && this.bodyParams.version) { - const baseUrl = settings.get('Apps_Framework_Marketplace_Url'); + const baseUrl = orchestrator.getMarketplaceUrl(); const headers = {}; const token = getWorkspaceAccessToken(true, 'marketplace:download', false); @@ -186,7 +186,7 @@ export class AppsRestApi { this.api.addRoute(':id', { authRequired: true, permissionsRequired: ['manage-apps'] }, { get() { if (this.queryParams.marketplace && this.queryParams.version) { - const baseUrl = settings.get('Apps_Framework_Marketplace_Url'); + const baseUrl = orchestrator.getMarketplaceUrl(); const headers = {}; const token = getWorkspaceAccessToken(); @@ -206,7 +206,7 @@ export class AppsRestApi { } if (this.queryParams.marketplace && this.queryParams.update && this.queryParams.appVersion) { - const baseUrl = settings.get('Apps_Framework_Marketplace_Url'); + const baseUrl = orchestrator.getMarketplaceUrl(); const headers = {}; const token = getWorkspaceAccessToken(); @@ -254,7 +254,7 @@ export class AppsRestApi { buff = Buffer.from(result.content, 'binary'); } else if (this.bodyParams.appId && this.bodyParams.marketplace && this.bodyParams.version) { - const baseUrl = settings.get('Apps_Framework_Marketplace_Url'); + const baseUrl = orchestrator.getMarketplaceUrl(); const headers = {}; const token = getWorkspaceAccessToken(); diff --git a/app/apps/server/orchestrator.js b/app/apps/server/orchestrator.js index 589a6a1dc9f7..b186e7ea4b9a 100644 --- a/app/apps/server/orchestrator.js +++ b/app/apps/server/orchestrator.js @@ -15,7 +15,7 @@ class AppServerOrchestrator { Permissions.createOrUpdate('manage-apps', ['admin']); } - this._inDebug = process.env.NODE_ENV !== 'production'; + this._marketplaceUrl = 'https://marketplace.rocket.chat'; this._model = new AppsModel(); this._logModel = new AppsLogsModel(); @@ -80,16 +80,20 @@ class AppServerOrchestrator { } isDebugging() { - return this._inDebug; + return settings.get('Apps_Framework_Development_Mode'); } debugLog() { - if (this._inDebug) { + if (this.isDebugging()) { // eslint-disable-next-line console.log(...arguments); } } + getMarketplaceUrl() { + return this._marketplaceUrl; + } + load() { // Don't try to load it again if it has // already been loaded @@ -131,11 +135,6 @@ settings.addGroup('General', function() { public: true, hidden: false, }); - - this.add('Apps_Framework_Marketplace_Url', 'https://marketplace.rocket.chat', { - type: 'string', - hidden: true, - }); }); });