From 51a25769ebfba0573ba99c5137c6582d614ed487 Mon Sep 17 00:00:00 2001 From: Daniel Lockyer Date: Mon, 27 Feb 2023 17:23:11 +0100 Subject: [PATCH] Moved Segment analytics file into service - this file is already in our "init"-style, so this commit simply moves the file into a service and fixes the import paths --- ghost/core/core/boot.js | 2 +- .../{analytics-events.js => services/segment/index.js} | 7 ++++--- 2 files changed, 5 insertions(+), 4 deletions(-) rename ghost/core/core/server/{analytics-events.js => services/segment/index.js} (91%) diff --git a/ghost/core/core/boot.js b/ghost/core/core/boot.js index b56ed128c6..504eb66f67 100644 --- a/ghost/core/core/boot.js +++ b/ghost/core/core/boot.js @@ -352,7 +352,7 @@ async function initServices({config}) { // Initialize analytics events if (config.get('segment:key')) { - require('./server/analytics-events').init(); + require('./server/services/segment').init(); } debug('End: initServices'); diff --git a/ghost/core/core/server/analytics-events.js b/ghost/core/core/server/services/segment/index.js similarity index 91% rename from ghost/core/core/server/analytics-events.js rename to ghost/core/core/server/services/segment/index.js index add20bb078..59e454243e 100644 --- a/ghost/core/core/server/analytics-events.js +++ b/ghost/core/core/server/services/segment/index.js @@ -1,11 +1,12 @@ const _ = require('lodash'); const Analytics = require('analytics-node'); -const config = require('../shared/config'); const logging = require('@tryghost/logging'); -const sentry = require('../shared/sentry'); + +const config = require('../../../shared/config'); +const sentry = require('../../../shared/sentry'); // Listens to model events to layer on analytics - also uses the "fake" theme.uploaded event from the theme API -const events = require('./lib/common/events'); +const events = require('../../lib/common/events'); module.exports.init = function () { const analytics = new Analytics(config.get('segment:key'));