From c2ae91e4db184d64c17bcd63f6e4e32343910fd1 Mon Sep 17 00:00:00 2001 From: Steve Larson <9larsons@gmail.com> Date: Thu, 29 Aug 2024 12:51:23 -0500 Subject: [PATCH] Added config flag to disable recommendations service (#20879) no ref This service can get rather noisy when doing local development with our data generator, as we do not use real urls, and therefore generate a lot of not found errors in the console. --- .../recommendations/RecommendationServiceWrapper.js | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/ghost/core/core/server/services/recommendations/RecommendationServiceWrapper.js b/ghost/core/core/server/services/recommendations/RecommendationServiceWrapper.js index 56372c495a..25c10a9343 100644 --- a/ghost/core/core/server/services/recommendations/RecommendationServiceWrapper.js +++ b/ghost/core/core/server/services/recommendations/RecommendationServiceWrapper.js @@ -39,11 +39,16 @@ class RecommendationServiceWrapper { incomingRecommendationService; init() { + const config = require('../../../shared/config'); + if (config.get('services:recommendations:enabled') === false) { + logging.info('[Recommendations] Service is disabled via config'); + return; + } + if (this.repository) { return; } - const config = require('../../../shared/config'); const urlUtils = require('../../../shared/url-utils'); const models = require('../../models'); const sentry = require('../../../shared/sentry');