From 1fecb08957a93bf8ac79e63bd2b2f29304d3970d Mon Sep 17 00:00:00 2001 From: Naz Date: Fri, 22 Sep 2023 15:27:42 +0800 Subject: [PATCH] Reworked the collections killswitch to always override labs refs https://github.com/TryGhost/Arch/issues/95 - We are releasing with a slight risk of failing over, so need a switch to allow disabling collections on hosted environment. --- ghost/core/core/server/services/collections/service.js | 8 ++++++-- .../e2e-api/admin/__snapshots__/settings.test.js.snap | 2 +- 2 files changed, 7 insertions(+), 3 deletions(-) diff --git a/ghost/core/core/server/services/collections/service.js b/ghost/core/core/server/services/collections/service.js index 86f017b869..20641a78d8 100644 --- a/ghost/core/core/server/services/collections/service.js +++ b/ghost/core/core/server/services/collections/service.js @@ -34,8 +34,12 @@ class CollectionsServiceWrapper { const config = require('../../../shared/config'); const labs = require('../../../shared/labs'); - // host setting OR labs "collections" flag has to be enabled to run collections service - if (config.get('hostSettings:collections:enabled') || labs.isSet('collections')) { + // CASE: emergency kill switch in case we need to disable collections outside of labs + if (config.get('hostSettings:collections:enabled') === false) { + return; + } + + if (labs.isSet('collections')) { if (inited) { return; } diff --git a/ghost/core/test/e2e-api/admin/__snapshots__/settings.test.js.snap b/ghost/core/test/e2e-api/admin/__snapshots__/settings.test.js.snap index 52146c7e17..b4e223ad08 100644 --- a/ghost/core/test/e2e-api/admin/__snapshots__/settings.test.js.snap +++ b/ghost/core/test/e2e-api/admin/__snapshots__/settings.test.js.snap @@ -758,7 +758,7 @@ exports[`Settings API Edit Can edit a setting 2: [headers] 1`] = ` Object { "access-control-allow-origin": "http://127.0.0.1:2369", "cache-control": "no-cache, private, no-store, must-revalidate, max-stale=0, post-check=0, pre-check=0", - "content-length": "4234", + "content-length": "4255", "content-type": "application/json; charset=utf-8", "content-version": StringMatching /v\\\\d\\+\\\\\\.\\\\d\\+/, "etag": StringMatching /\\(\\?:W\\\\/\\)\\?"\\(\\?:\\[ !#-\\\\x7E\\\\x80-\\\\xFF\\]\\*\\|\\\\r\\\\n\\[\\\\t \\]\\|\\\\\\\\\\.\\)\\*"/,