Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix debug logging not being enabled by the setting #13979

Merged
merged 6 commits into from Apr 6, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
10 changes: 5 additions & 5 deletions app/apps/server/communication/rest.js
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
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