Skip to content

Commit

Permalink
Fix debug logging not being enabled by the setting (#13979)
Browse files Browse the repository at this point in the history
* Ensure official marketplace & use the debug setting instead of environmental

* Whoops, use the real url instead of the testing one

:see_no_evil:

Co-Authored-By: graywolf336 <graywolf336@craftyn.com>

* Update rest.js
  • Loading branch information
graywolf336 authored and rodrigok committed Apr 6, 2019
1 parent bc80e0e commit f5d463c
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 13 deletions.
10 changes: 5 additions & 5 deletions app/apps/server/communication/rest.js
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand Down Expand Up @@ -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);
Expand Down Expand Up @@ -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();
Expand All @@ -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();
Expand Down Expand Up @@ -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();
Expand Down
15 changes: 7 additions & 8 deletions app/apps/server/orchestrator.js
Original file line number Diff line number Diff line change
Expand Up @@ -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();
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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,
});
});
});

Expand Down

0 comments on commit f5d463c

Please sign in to comment.