Added sentry config to frontend site settings for Portal (#13086)

no refs

- adds sentry config for portal when available to integrate error handling
This commit is contained in:
Rishabh Garg 2021-06-21 17:59:20 +05:30 committed by GitHub
parent 484387ba51
commit acb0bd47af
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 11 additions and 1 deletions

View File

@ -6,6 +6,7 @@ const ghostVersion = require('@tryghost/version');
const settingsCache = require('../settings/cache');
const {formattedMemberResponse} = require('./utils');
const labsService = require('../labs');
const config = require('../../../shared/config');
// @TODO: This piece of middleware actually belongs to the frontend, not to the member app
// Need to figure a way to separate these things (e.g. frontend actually talks to members API)
@ -124,6 +125,8 @@ const getMemberSiteData = async function (req, res) {
supportAddress = `${supportAddress}@${blogDomain}`;
}
const {products = [], prices = []} = await getPortalProductPrices() || {};
const portalVersion = config.get('portal:version');
const response = {
title: settingsCache.get('title'),
description: settingsCache.get('description'),
@ -132,6 +135,7 @@ const getMemberSiteData = async function (req, res) {
accent_color: settingsCache.get('accent_color'),
url: urlUtils.urlFor('home', true),
version: ghostVersion.safe,
portal_version: portalVersion,
free_price_name: settingsCache.get('members_free_price_name'),
free_price_description: settingsCache.get('members_free_price_description'),
allow_self_signup: membersService.config.getAllowSelfSignup(),
@ -151,6 +155,12 @@ const getMemberSiteData = async function (req, res) {
if (labsService.isSet('multipleProducts')) {
response.portal_products = settingsCache.get('portal_products');
}
if (config.get('portal_sentry') && !config.get('portal_sentry').disabled) {
response.portal_sentry = {
sentry_dsn: config.get('portal_sentry').dsn,
sentry_env: config.get('env')
};
}
res.json({site: response});
};

View File

@ -122,6 +122,6 @@
},
"portal": {
"url": "https://unpkg.com/@tryghost/portal@~1.6.0/umd/portal.min.js",
"version": "~1.6.0"
"version": "1.6"
}
}