Moved settings/cache to shared/settings-cache

- This is part of the quest to separate the frontend and server & get rid of all the places where there are cross-requires
- At the moment the settings cache is one big shared cache used by the frontend and server liberally
- This change doesn't really solve the fundamental problems, as we still depend on events, and requires from inside frontend
- However it allows us to control the misuse slightly better by getting rid of restricted requires and turning on that eslint ruleset
This commit is contained in:
Hannah Wolfe 2021-06-30 14:56:57 +01:00
parent 3ea6df819c
commit bd597db829
No known key found for this signature in database
GPG Key ID: 9F8C7532D0A6BA55
97 changed files with 120 additions and 96 deletions

View File

@ -14,7 +14,7 @@ const logging = require('@tryghost/logging');
const events = require('./server/lib/common/events');
const tpl = require('@tryghost/tpl');
const themeEngine = require('./frontend/services/theme-engine');
const settingsCache = require('./server/services/settings/cache');
const settingsCache = require('./shared/settings-cache');
const messages = {
activateFailed: 'Unable to activate the theme "{theme}".'

View File

@ -3,7 +3,7 @@ const registerHelpers = require('./lib/helpers');
const urlUtils = require('../../../shared/url-utils');
// Dirty requires
const settingsCache = require('../../../server/services/settings/cache');
const settingsCache = require('../../../shared/settings-cache');
function ampRouter(req, res) {
if (settingsCache.get('amp') === true) {

View File

@ -7,7 +7,7 @@ const urlUtils = require('../../../../shared/url-utils');
const constants = require('@tryghost/constants');
const {i18n} = require('../../../services/proxy');
const errors = require('@tryghost/errors');
const settingsCache = require('../../../../server/services/settings/cache');
const settingsCache = require('../../../../shared/settings-cache');
// routeKeywords.private: 'private'
const privateRoute = '/private/';

View File

@ -1,5 +1,5 @@
const urlUtils = require('../../shared/url-utils');
const settingsCache = require('../../server/services/settings/cache');
const settingsCache = require('../../shared/settings-cache');
const {blogIcon} = require('../../server/lib/image');
function getBlogLogo() {

View File

@ -1,4 +1,4 @@
const settingsCache = require('../../server/services/settings/cache');
const settingsCache = require('../../shared/settings-cache');
const _ = require('lodash');
function getContextObject(data, context) {

View File

@ -1,5 +1,5 @@
const _ = require('lodash');
const settingsCache = require('../../server/services/settings/cache');
const settingsCache = require('../../shared/settings-cache');
const getExcerpt = require('./excerpt');
function getDescription(data, root, options = {}) {

View File

@ -1,5 +1,5 @@
const Promise = require('bluebird');
const settingsCache = require('../../server/services/settings/cache');
const settingsCache = require('../../shared/settings-cache');
const urlUtils = require('../../shared/url-utils');
const logging = require('@tryghost/logging');
const getUrl = require('./url');

View File

@ -1,7 +1,7 @@
const _ = require('lodash');
const getContextObject = require('./context_object.js');
const urlUtils = require('../../shared/url-utils');
const settingsCache = require('../../server/services/settings/cache');
const settingsCache = require('../../shared/settings-cache');
function getOgImage(data) {
const context = data.context ? data.context : null;

View File

@ -1,5 +1,5 @@
const _ = require('lodash');
const settingsCache = require('../../server/services/settings/cache');
const settingsCache = require('../../shared/settings-cache');
function getTitle(data, root, options = {}) {
const context = root ? root.context : null;

View File

@ -1,7 +1,7 @@
const _ = require('lodash');
const urlUtils = require('../../shared/url-utils');
const getContextObject = require('./context_object.js');
const settingsCache = require('../../server/services/settings/cache');
const settingsCache = require('../../shared/settings-cache');
function getTwitterImage(data) {
const context = data.context ? data.context : null;

View File

@ -6,7 +6,7 @@ const errors = require('@tryghost/errors');
const i18n = require('../../shared/i18n');
const logging = require('@tryghost/logging');
const settingsCache = require('../../server/services/settings/cache');
const settingsCache = require('../../shared/settings-cache');
const config = require('../../shared/config');
// Direct requires:

View File

@ -2,7 +2,7 @@ const _ = require('lodash');
const debug = require('@tryghost/debug')('services:routing:controllers:rss');
const url = require('url');
const security = require('@tryghost/security');
const settingsCache = require('../../../../server/services/settings/cache');
const settingsCache = require('../../../../shared/settings-cache');
const rssService = require('../../rss');
const helpers = require('../helpers');

View File

@ -4,7 +4,7 @@ const urlUtils = require('../../../shared/url-utils');
const config = require('../../../shared/config');
const {i18n, api} = require('../proxy');
const errors = require('@tryghost/errors');
const settingsCache = require('../../../server/services/settings/cache');
const settingsCache = require('../../../shared/settings-cache');
const labs = require('../../../server/services/labs');
const activeTheme = require('./active');
const preview = require('./preview');

View File

@ -1,4 +1,4 @@
const settings = require('../../services/settings/cache');
const settings = require('../../../shared/settings-cache');
const urlUtils = require('../../../shared/url-utils');
const jwt = require('jsonwebtoken');
const jose = require('node-jose');

View File

@ -7,7 +7,7 @@ const models = require('../../models');
const membersService = require('../../services/members');
const labsService = require('../../services/labs');
const settingsCache = require('../../services/settings/cache');
const settingsCache = require('../../../shared/settings-cache');
const i18n = require('../../../shared/i18n');
const _ = require('lodash');

View File

@ -1,4 +1,4 @@
const settingsCache = require('../../services/settings/cache');
const settingsCache = require('../../../shared/settings-cache');
const urlUtils = require('../../../shared/url-utils');
module.exports = {

View File

@ -7,7 +7,7 @@ const frontendSettings = require('../../../frontend/services/settings');
const i18n = require('../../../shared/i18n');
const {BadRequestError, NoPermissionError, NotFoundError} = require('@tryghost/errors');
const settingsService = require('../../services/settings');
const settingsCache = require('../../services/settings/cache');
const settingsCache = require('../../../shared/settings-cache');
const membersService = require('../../services/members');
const ghostBookshelf = require('../../models/base');

View File

@ -1,7 +1,7 @@
const _ = require('lodash');
const url = require('./utils/url');
const typeGroupMapper = require('../../../../shared/serializers/input/utils/settings-filter-type-group-mapper');
const settingsCache = require('../../../../../services/settings/cache');
const settingsCache = require('../../../../../../shared/settings-cache');
const {WRITABLE_KEYS_ALLOWLIST} = require('../../../../../services/labs');
const DEPRECATED_SETTINGS = [

View File

@ -1,5 +1,5 @@
const moment = require('moment-timezone');
const settingsCache = require('../../../../../../services/settings/cache');
const settingsCache = require('../../../../../../../shared/settings-cache');
const format = (date) => {
return moment(date)

View File

@ -1,4 +1,4 @@
const settingsCache = require('../../services/settings/cache');
const settingsCache = require('../../../shared/settings-cache');
const urlUtils = require('../../../shared/url-utils');
module.exports = {

View File

@ -6,7 +6,7 @@ const frontendSettings = require('../../../frontend/services/settings');
const i18n = require('../../../shared/i18n');
const {NoPermissionError, NotFoundError} = require('@tryghost/errors');
const settingsService = require('../../services/settings');
const settingsCache = require('../../services/settings/cache');
const settingsCache = require('../../../shared/settings-cache');
module.exports = {
docName: 'settings',

View File

@ -1,7 +1,7 @@
const _ = require('lodash');
const url = require('./utils/url');
const typeGroupMapper = require('../../../../shared/serializers/input/utils/settings-filter-type-group-mapper');
const settingsCache = require('../../../../../services/settings/cache');
const settingsCache = require('../../../../../../shared/settings-cache');
const DEPRECATED_SETTINGS = [
'bulk_email_settings',

View File

@ -1,5 +1,5 @@
const moment = require('moment-timezone');
const settingsCache = require('../../../../../../services/settings/cache');
const settingsCache = require('../../../../../../../shared/settings-cache');
const format = (date) => {
return moment(date)

View File

@ -1,4 +1,4 @@
const settings = require('../../services/settings/cache');
const settings = require('../../../shared/settings-cache');
const urlUtils = require('../../../shared/url-utils');
const jwt = require('jsonwebtoken');
const jose = require('node-jose');

View File

@ -6,7 +6,7 @@ const errors = require('@tryghost/errors');
const models = require('../../models');
const membersService = require('../../services/members');
const settingsCache = require('../../services/settings/cache');
const settingsCache = require('../../../shared/settings-cache');
const i18n = require('../../../shared/i18n');
const allowedIncludes = ['email_recipients'];

View File

@ -1,4 +1,4 @@
const settingsCache = require('../../services/settings/cache');
const settingsCache = require('../../../shared/settings-cache');
const urlUtils = require('../../../shared/url-utils');
module.exports = {

View File

@ -7,7 +7,7 @@ const frontendSettings = require('../../../frontend/services/settings');
const i18n = require('../../../shared/i18n');
const {BadRequestError, NoPermissionError, NotFoundError} = require('@tryghost/errors');
const settingsService = require('../../services/settings');
const settingsCache = require('../../services/settings/cache');
const settingsCache = require('../../../shared/settings-cache');
const membersService = require('../../services/members');
module.exports = {

View File

@ -1,7 +1,7 @@
const _ = require('lodash');
const url = require('./utils/url');
const typeGroupMapper = require('../../../../shared/serializers/input/utils/settings-filter-type-group-mapper');
const settingsCache = require('../../../../../services/settings/cache');
const settingsCache = require('../../../../../../shared/settings-cache');
const DEPRECATED_SETTINGS = [
'bulk_email_settings',

View File

@ -1,5 +1,5 @@
const moment = require('moment-timezone');
const settingsCache = require('../../../../../../services/settings/cache');
const settingsCache = require('../../../../../../../shared/settings-cache');
const format = (date) => {
return moment(date)

View File

@ -1,7 +1,7 @@
const _ = require('lodash');
const Promise = require('bluebird');
const logging = require('@tryghost/logging');
const settingsCache = require('../../../../services/settings/cache');
const settingsCache = require('../../../../../shared/settings-cache');
const config = require('../../../../../shared/config');
const moment = require('moment');
const fs = require('fs-extra');

View File

@ -1,7 +1,7 @@
const logging = require('@tryghost/logging');
const {createTransactionalMigration} = require('../../utils');
const MembersConfigProvider = require('../../../../services/members/config');
const settingsCache = require('../../../../services/settings/cache');
const settingsCache = require('../../../../../shared/settings-cache');
const config = require('../../../../../shared/config');
// members_allow_free_signup was migrated to members_signup_access in 4.3/08-migrate-members-signup-setting

View File

@ -1,3 +1,16 @@
/**
* Why has this not been moved to e.g. @tryghost/events or shared yet?
*
* - We currently massively overuse this utility, coupling together bits of the codebase in unexpected ways
* - We want to prevent this, not reinforce it
* * Having an @tryghost/events or shared/events module would reinforce this bad patter of using the same event emitter everywhere
*
* - Ideally, we want to refactor to:
* - either remove dependence on events where we can
* - or have separate event emitters for e.g. model layer and routing layer
*
*/
const events = require('events');
const util = require('util');
let EventRegistry;

View File

@ -6,7 +6,7 @@ const validator = require('@tryghost/validator');
const config = require('../../../shared/config');
const logging = require('@tryghost/logging');
const i18n = require('../../../shared/i18n');
const settingsCache = require('../../services/settings/cache');
const settingsCache = require('../../../shared/settings-cache');
const ImageUtils = require('./image-utils');
module.exports = new ImageUtils({config, logging, i18n, urlUtils, settingsCache, storageUtils, storage, validator, request});

View File

@ -3,7 +3,7 @@ const _ = require('lodash');
const validator = require('@tryghost/validator');
const tpl = require('@tryghost/tpl');
const settingsCache = require('../services/settings/cache');
const settingsCache = require('../../shared/settings-cache');
const urlUtils = require('../../shared/url-utils');
const messages = {

View File

@ -4,7 +4,7 @@ const i18n = require('../../shared/i18n');
const errors = require('@tryghost/errors');
const constants = require('@tryghost/constants');
const security = require('@tryghost/security');
const settingsCache = require('../services/settings/cache');
const settingsCache = require('../../shared/settings-cache');
const limitService = require('../services/limits');
const ghostBookshelf = require('./base');

View File

@ -10,7 +10,7 @@ const nql = require('@nexes/nql');
const htmlToPlaintext = require('../../shared/html-to-plaintext');
const ghostBookshelf = require('./base');
const config = require('../../shared/config');
const settingsCache = require('../services/settings/cache');
const settingsCache = require('../../shared/settings-cache');
const limitService = require('../services/limits');
const mobiledocLib = require('../lib/mobiledoc');
const relations = require('./relations');

View File

@ -2,7 +2,7 @@ const util = require('util');
const session = require('express-session');
const constants = require('@tryghost/constants');
const config = require('../../../../shared/config');
const settingsCache = require('../../settings/cache');
const settingsCache = require('../../../../shared/settings-cache');
const models = require('../../../models');
const urlUtils = require('../../../../shared/url-utils');

View File

@ -3,7 +3,7 @@ const {URL} = require('url');
const mailgun = require('mailgun-js');
const logging = require('@tryghost/logging');
const configService = require('../../../shared/config');
const settingsCache = require('../settings/cache');
const settingsCache = require('../../../shared/settings-cache');
const BATCH_SIZE = 1000;

View File

@ -1,7 +1,7 @@
const config = require('../../../shared/config');
const logging = require('@tryghost/logging');
const db = require('../../data/db');
const settings = require('../settings/cache');
const settings = require('../../../shared/settings-cache');
const {EmailAnalyticsService} = require('@tryghost/email-analytics-service');
const EventProcessor = require('./lib/event-processor');
const MailgunProvider = require('@tryghost/email-analytics-provider-mailgun');

View File

@ -1,4 +1,4 @@
const settingsCache = require('../settings/cache');
const settingsCache = require('../../../shared/settings-cache');
const i18n = require('../../../shared/i18n');
const mailService = require('../../services/mail');
const logging = require('@tryghost/logging');

View File

@ -4,7 +4,7 @@ const SafeString = require('../../frontend/services/theme-engine/engine').SafeSt
const errors = require('@tryghost/errors');
const i18n = require('../../shared/i18n');
const logging = require('@tryghost/logging');
const settingsCache = require('../services/settings/cache');
const settingsCache = require('../../shared/settings-cache');
const config = require('../../shared/config');
// NOTE: this allowlist is meant to be used to filter out any unexpected

View File

@ -6,7 +6,7 @@ const validator = require('@tryghost/validator');
const config = require('../../../shared/config');
const errors = require('@tryghost/errors');
const i18n = require('../../../shared/i18n');
const settingsCache = require('../settings/cache');
const settingsCache = require('../../../shared/settings-cache');
const urlUtils = require('../../../shared/url-utils');
function getDomain() {

View File

@ -3,7 +3,7 @@ const fs = require('fs-extra');
const path = require('path');
const htmlToText = require('html-to-text');
const urlUtils = require('../../../shared/url-utils');
const settingsCache = require('../settings/cache');
const settingsCache = require('../../../shared/settings-cache');
const templatesDir = path.resolve(__dirname, '..', 'mail', 'templates');
_.templateSettings.interpolate = /{{([\s\S]+?)}}/g;

View File

@ -8,7 +8,7 @@ const errors = require('@tryghost/errors');
const events = require('../../lib/common/events');
const i18n = require('../../../shared/i18n');
const logging = require('@tryghost/logging');
const settingsCache = require('../settings/cache');
const settingsCache = require('../../../shared/settings-cache');
const membersService = require('../members');
const limitService = require('../limits');
const bulkEmailService = require('../bulk-email');

View File

@ -1,7 +1,7 @@
const _ = require('lodash');
const juice = require('juice');
const template = require('./template');
const settingsCache = require('../../services/settings/cache');
const settingsCache = require('../../../shared/settings-cache');
const labs = require('../../services/labs');
const urlUtils = require('../../../shared/url-utils');
const moment = require('moment-timezone');

View File

@ -1,4 +1,4 @@
const settingsCache = require('../settings/cache');
const settingsCache = require('../../../shared/settings-cache');
const MembersApi = require('@tryghost/members-api');
const logging = require('@tryghost/logging');
const mail = require('../mail');

View File

@ -3,7 +3,7 @@ const logging = require('@tryghost/logging');
const membersService = require('./service');
const urlUtils = require('../../../shared/url-utils');
const ghostVersion = require('@tryghost/version');
const settingsCache = require('../settings/cache');
const settingsCache = require('../../../shared/settings-cache');
const {formattedMemberResponse} = require('./utils');
const labsService = require('../labs');
const config = require('../../../shared/config');

View File

@ -8,7 +8,7 @@ const createMembersSettingsInstance = require('./settings');
const events = require('../../lib/common/events');
const logging = require('@tryghost/logging');
const urlUtils = require('../../../shared/url-utils');
const settingsCache = require('../settings/cache');
const settingsCache = require('../../../shared/settings-cache');
const config = require('../../../shared/config');
const ghostVersion = require('@tryghost/version');
const _ = require('lodash');

View File

@ -2,7 +2,7 @@ const MagicLink = require('@tryghost/magic-link');
const {URL} = require('url');
const path = require('path');
const urlUtils = require('../../../shared/url-utils');
const settingsCache = require('../settings/cache');
const settingsCache = require('../../../shared/settings-cache');
const logging = require('@tryghost/logging');
const mail = require('../mail');
const updateEmailTemplate = require('./emails/updateEmail');

View File

@ -1,4 +1,4 @@
const settingsCache = require('../settings/cache');
const settingsCache = require('../../../shared/settings-cache');
const i18n = require('../../../shared/i18n');
const ghostVersion = require('@tryghost/version');
const Notifications = require('./notifications');

View File

@ -1,5 +1,5 @@
const ghostVersion = require('@tryghost/version');
const settingsCache = require('../settings/cache');
const settingsCache = require('../../../shared/settings-cache');
const config = require('../../../shared/config');
const urlUtils = require('../../../shared/url-utils');

View File

@ -4,7 +4,7 @@
*/
const events = require('../../lib/common/events');
const models = require('../../models');
const SettingsCache = require('./cache');
const SettingsCache = require('../../../shared/settings-cache');
// The string returned when a setting is set as write-only
const obfuscatedSetting = '••••••••';

View File

@ -6,7 +6,7 @@ const request = require('@tryghost/request');
const {blogIcon} = require('../lib/image');
const urlUtils = require('../../shared/url-utils');
const urlService = require('../../frontend/services/url');
const settingsCache = require('./settings/cache');
const settingsCache = require('../../shared/settings-cache');
const schema = require('../data/schema').checks;
const moment = require('moment');

View File

@ -7,7 +7,7 @@ const themeLoader = require('./loader');
const bridge = require('../../../bridge');
const validate = require('./validate');
const list = require('./list');
const settingsCache = require('../settings/cache');
const settingsCache = require('../../../shared/settings-cache');
module.exports = {
// Init themes module

View File

@ -7,7 +7,7 @@ const ThemeStorage = require('./ThemeStorage');
const themeLoader = require('./loader');
const toJSON = require('./to-json');
const settingsCache = require('../settings/cache');
const settingsCache = require('../../../shared/settings-cache');
const i18n = require('../../../shared/i18n');
const logging = require('@tryghost/logging');
const errors = require('@tryghost/errors');

View File

@ -2,7 +2,7 @@ const _ = require('lodash');
const themeList = require('./list');
const bridge = require('../../../bridge');
const packageJSON = require('@tryghost/package-json');
const settingsCache = require('../settings/cache');
const settingsCache = require('../../../shared/settings-cache');
/**
*

View File

@ -7,7 +7,7 @@ const events = require('../lib/common/events');
const i18n = require('../../shared/i18n');
const logging = require('@tryghost/logging');
const request = require('@tryghost/request');
const settingsCache = require('./settings/cache');
const settingsCache = require('../../shared/settings-cache');
const sentry = require('../../shared/sentry');
const defaultPostSlugs = [

View File

@ -6,7 +6,7 @@ const express = require('../../../shared/express');
const urlUtils = require('../../../shared/url-utils');
const shared = require('../shared');
const config = require('../../../shared/config');
const settingsCache = require('../../services/settings/cache');
const settingsCache = require('../../../shared/settings-cache');
const models = require('../../models');
const auth = require('../../services/auth');

View File

@ -5,7 +5,7 @@ const config = require('../../../../shared/config');
const {blogIcon} = require('../../../lib/image');
const storage = require('../../../adapters/storage');
const urlUtils = require('../../../../shared/url-utils');
const settingsCache = require('../../../services/settings/cache');
const settingsCache = require('../../../../shared/settings-cache');
let content;

View File

@ -1,5 +1,5 @@
const express = require('../../shared/express');
const settings = require('../services/settings/cache');
const settings = require('../../shared/settings-cache');
const jose = require('node-jose');
const dangerousPrivateKey = settings.get('ghost_private_key');

View File

@ -0,0 +1,9 @@
/**
* Why hasn't this been moved to @tryghost/settings-cache yet?
*
* - It currently still couples the frontend and server together in a weird way via the event system
* - See the notes in core/server/lib/common/events
* - There's also a plan to introduce a proper caching layer, and rewrite this on top of that
* - Finally, I'm not sure if this shouldn't be two things - a cache, and a cache manager (the update system)
*/
module.exports = require('./cache');

View File

@ -6,7 +6,7 @@ const config = require('../../../core/shared/config');
const localUtils = require('./utils');
// Values to test against
const publicSettings = require('../../../core/server/services/settings/public');
const publicSettings = require('../../../core/shared/settings-cache/public');
const defaultSettings = require('../../../core/server/data/schema').defaultSettings;
const defaultSettingsKeys = [

View File

@ -13,7 +13,7 @@ const cheerio = require('cheerio');
const _ = require('lodash');
const testUtils = require('../utils');
const configUtils = require('../utils/configUtils');
const settingsCache = require('../../core/server/services/settings/cache');
const settingsCache = require('../../core/shared/settings-cache');
const origCache = _.cloneDeep(settingsCache);
function assertCorrectFrontendHeaders(res) {

View File

@ -4,7 +4,7 @@ const supertest = require('supertest');
const moment = require('moment');
const testUtils = require('../utils');
const configUtils = require('../utils/configUtils');
const settingsCache = require('../../core/server/services/settings/cache');
const settingsCache = require('../../core/shared/settings-cache');
function assertContentIsPresent(res) {
res.text.should.containEql('<h2 id="markdown">markdown</h2>');

View File

@ -5,7 +5,7 @@ const localUtils = require('./utils');
const testUtils = require('../../../../utils/index');
const models = require('../../../../../core/server/models/index');
const security = require('@tryghost/security');
const settingsCache = require('../../../../../core/server/services/settings/cache');
const settingsCache = require('../../../../../core/shared/settings-cache');
const config = require('../../../../../core/shared/config/index');
const mailService = require('../../../../../core/server/services/mail/index');

View File

@ -5,7 +5,7 @@ const localUtils = require('./utils');
const testUtils = require('../../../../utils/index');
const models = require('../../../../../core/server/models/index');
const security = require('@tryghost/security');
const settingsCache = require('../../../../../core/server/services/settings/cache');
const settingsCache = require('../../../../../core/shared/settings-cache');
const config = require('../../../../../core/shared/config/index');
const mailService = require('../../../../../core/server/services/mail/index');
const configUtils = require('../../../../utils/configUtils');

View File

@ -5,7 +5,7 @@ const localUtils = require('./utils');
const testUtils = require('../../../../utils/index');
const models = require('../../../../../core/server/models/index');
const security = require('@tryghost/security');
const settingsCache = require('../../../../../core/server/services/settings/cache');
const settingsCache = require('../../../../../core/shared/settings-cache');
const config = require('../../../../../core/shared/config/index');
const mailService = require('../../../../../core/server/services/mail/index');

View File

@ -10,7 +10,7 @@ const urlService = require('../../../core/frontend/services/url');
const ghostBookshelf = require('../../../core/server/models/base');
const models = require('../../../core/server/models');
const db = require('../../../core/server/data/db');
const settingsCache = require('../../../core/server/services/settings/cache');
const settingsCache = require('../../../core/shared/settings-cache');
const events = require('../../../core/server/lib/common/events');
const configUtils = require('../../utils/configUtils');
const context = testUtils.context.owner;

View File

@ -12,7 +12,7 @@ const configUtils = require('../../utils/configUtils');
const cheerio = require('cheerio');
const config = require('../../../core/shared/config');
const api = require('../../../core/server/api');
const settingsCache = require('../../../core/server/services/settings/cache');
const settingsCache = require('../../../core/shared/settings-cache');
const ghost = testUtils.startGhost;
let request;

View File

@ -1,6 +1,6 @@
const should = require('should');
const sinon = require('sinon');
const settingsCache = require('../../../../../../../../core/server/services/settings/cache');
const settingsCache = require('../../../../../../../../core/shared/settings-cache');
const dateUtil = require('../../../../../../../../core/server/api/canary/utils/serializers/output/utils/date');
describe('Unit: canary/utils/serializers/output/utils/date', function () {

View File

@ -1,6 +1,6 @@
const should = require('should');
const sinon = require('sinon');
const settingsCache = require('../../../../../../../../core/server/services/settings/cache');
const settingsCache = require('../../../../../../../../core/shared/settings-cache');
const dateUtil = require('../../../../../../../../core/server/api/v2/utils/serializers/output/utils/date');
describe('Unit: v2/utils/serializers/output/utils/date', function () {

View File

@ -1,6 +1,6 @@
const should = require('should');
const sinon = require('sinon');
const settingsCache = require('../../../../../../../../core/server/services/settings/cache');
const settingsCache = require('../../../../../../../../core/shared/settings-cache');
const dateUtil = require('../../../../../../../../core/server/api/v3/utils/serializers/output/utils/date');
describe('Unit: v3/utils/serializers/output/utils/date', function () {

View File

@ -3,7 +3,7 @@ const should = require('should');
const sinon = require('sinon');
const crypto = require('crypto');
const fs = require('fs-extra');
const settingsCache = require('../../../../core/server/services/settings/cache');
const settingsCache = require('../../../../core/shared/settings-cache');
const privateBlogging = require('../../../../core/frontend/apps/private-blogging/lib/middleware');
function hash(password, salt) {

View File

@ -2,7 +2,7 @@ const should = require('should');
const sinon = require('sinon');
const rewire = require('rewire');
const imageLib = require('../../../../core/server/lib/image');
const settingsCache = require('../../../../core/server/services/settings/cache');
const settingsCache = require('../../../../core/shared/settings-cache');
const configUtils = require('../../../utils/configUtils');
const config = configUtils.config;

View File

@ -1,7 +1,7 @@
const should = require('should');
const getBlogLogo = require('../../../../core/frontend/meta/blog_logo');
const sinon = require('sinon');
const settingsCache = require('../../../../core/server/services/settings/cache');
const settingsCache = require('../../../../core/shared/settings-cache');
describe('getBlogLogo', function () {
afterEach(function () {

View File

@ -1,7 +1,7 @@
const should = require('should');
const sinon = require('sinon');
const getContextObject = require('../../../../core/frontend/meta/context_object.js');
const settingsCache = require('../../../../core/server/services/settings/cache');
const settingsCache = require('../../../../core/shared/settings-cache');
describe('getContextObject', function () {
let data;

View File

@ -1,7 +1,7 @@
const should = require('should');
const sinon = require('sinon');
const getMetaDescription = require('../../../../core/frontend/meta/description');
const settingsCache = require('../../../../core/server/services/settings/cache');
const settingsCache = require('../../../../core/shared/settings-cache');
describe('getMetaDescription', function () {
let localSettingsCache = {};

View File

@ -1,7 +1,7 @@
const should = require('should');
const sinon = require('sinon');
const getOgImage = require('../../../../core/frontend/meta/og_image');
const settingsCache = require('../../../../core/server/services/settings/cache');
const settingsCache = require('../../../../core/shared/settings-cache');
describe('getOgImage', function () {
let localSettingsCache = {};

View File

@ -1,7 +1,7 @@
const should = require('should');
const sinon = require('sinon');
const getTitle = require('../../../../core/frontend/meta/title');
const settingsCache = require('../../../../core/server/services/settings/cache');
const settingsCache = require('../../../../core/shared/settings-cache');
describe('getTitle', function () {
let localSettingsCache = {};

View File

@ -1,7 +1,7 @@
const should = require('should');
const sinon = require('sinon');
const getTwitterImage = require('../../../../core/frontend/meta/twitter_image');
const settingsCache = require('../../../../core/server/services/settings/cache');
const settingsCache = require('../../../../core/shared/settings-cache');
describe('getTwitterImage', function () {
let localSettingsCache = {};

View File

@ -6,7 +6,7 @@ const should = require('should');
const sinon = require('sinon');
const configUtils = require('../../utils/configUtils');
const helpers = require('../../../core/frontend/helpers');
const settingsCache = require('../../../core/server/services/settings/cache');
const settingsCache = require('../../../core/shared/settings-cache');
describe('{{asset}} helper', function () {
let rendered;

View File

@ -1,7 +1,7 @@
const should = require('should');
const sinon = require('sinon');
const helpers = require('../../../core/frontend/helpers');
const settingsCache = require('../../../core/server/services/settings/cache');
const settingsCache = require('../../../core/shared/settings-cache');
describe('{{meta_description}} helper', function () {
const localSettingsCache = {};

View File

@ -2,7 +2,7 @@ const should = require('should');
const sinon = require('sinon');
const configUtils = require('../../utils/configUtils');
const helpers = require('../../../core/frontend/helpers');
const settingsCache = require('../../../core/server/services/settings/cache');
const settingsCache = require('../../../core/shared/settings-cache');
describe('{{meta_title}} helper', function () {
describe('no meta_title', function () {

View File

@ -2,7 +2,7 @@ const errors = require('@tryghost/errors');
const sinon = require('sinon');
const Promise = require('bluebird');
const models = require('../../../core/server/models');
const settingsCache = require('../../../core/server/services/settings/cache');
const settingsCache = require('../../../core/shared/settings-cache');
describe('Unit: models/invite', function () {
before(function () {

View File

@ -3,7 +3,7 @@ const sinon = require('sinon');
const configUtils = require('../../utils/configUtils');
const labs = require('../../../core/server/services/labs');
const settingsCache = require('../../../core/server/services/settings/cache');
const settingsCache = require('../../../core/shared/settings-cache');
describe('Labs Service', function () {
afterEach(function () {

View File

@ -2,7 +2,7 @@ const should = require('should');
const sinon = require('sinon');
const Promise = require('bluebird');
const mail = require('../../../../core/server/services/mail');
const settingsCache = require('../../../../core/server/services/settings/cache');
const settingsCache = require('../../../../core/shared/settings-cache');
const configUtils = require('../../../utils/configUtils');
const urlUtils = require('../../../../core/shared/url-utils');
const i18n = require('../../../../core/shared/i18n');

View File

@ -4,7 +4,7 @@ const sinon = require('sinon');
const urlUtils = require('../../../../core/shared/url-utils');
const membersService = require('../../../../core/server/services/members');
const membersMiddleware = require('../../../../core/server/services/members/middleware');
const settingsCache = require('../../../../core/server/services/settings/cache');
const settingsCache = require('../../../../core/shared/settings-cache');
describe('Members Service Middleware', function () {
describe('createSessionFromMagicLink', function () {

View File

@ -1,7 +1,7 @@
const should = require('should');
const sinon = require('sinon');
const express = require('../../../../core/shared/express')._express;
const settingsCache = require('../../../../core/server/services/settings/cache');
const settingsCache = require('../../../../core/shared/settings-cache');
const events = require('../../../../core/server/lib/common/events');
const controllers = require('../../../../core/frontend/services/routing/controllers');
const CollectionRouter = require('../../../../core/frontend/services/routing/CollectionRouter');

View File

@ -1,7 +1,7 @@
const should = require('should');
const sinon = require('sinon');
const _ = require('lodash');
const settingsCache = require('../../../../core/server/services/settings/cache');
const settingsCache = require('../../../../core/shared/settings-cache');
const events = require('../../../../core/server/lib/common/events');
const controllers = require('../../../../core/frontend/services/routing/controllers');
const TaxonomyRouter = require('../../../../core/frontend/services/routing/TaxonomyRouter');

View File

@ -1,7 +1,7 @@
const sinon = require('sinon');
const testUtils = require('../../../../utils');
const security = require('@tryghost/security');
const settingsCache = require('../../../../../core/server/services/settings/cache');
const settingsCache = require('../../../../../core/shared/settings-cache');
const controllers = require('../../../../../core/frontend/services/routing/controllers');
const helpers = require('../../../../../core/frontend/services/routing/helpers');
const rssService = require('../../../../../core/frontend/services/rss');

View File

@ -12,7 +12,7 @@ const logging = require('@tryghost/logging');
const imageLib = require('../../../core/server/lib/image');
const urlService = require('../../../core/frontend/services/url');
const schema = require('../../../core/server/data/schema').checks;
const settingsCache = require('../../../core/server/services/settings/cache');
const settingsCache = require('../../../core/shared/settings-cache');
// Test data
const slackURL = 'https://hooks.slack.com/services/a-b-c-d';

View File

@ -4,7 +4,7 @@ const hbs = require('../../../../core/frontend/services/theme-engine/engine');
const middleware = require('../../../../core/frontend/services/theme-engine').middleware;
// is only exposed via themeEngine.getActive()
const activeTheme = require('../../../../core/frontend/services/theme-engine/active');
const settingsCache = require('../../../../core/server/services/settings/cache');
const settingsCache = require('../../../../core/shared/settings-cache');
const sandbox = sinon.createSandbox();

View File

@ -2,15 +2,17 @@ const rewire = require('rewire');
const should = require('should');
const sinon = require('sinon');
const _ = require('lodash');
const events = require('../../../../core/server/lib/common/events');
const publicSettings = require('../../../../core/server/services/settings/public');
let cache = rewire('../../../../core/server/services/settings/cache');
const events = require('../../../core/server/lib/common/events');
// Testing the Private API
let cache = rewire('../../../core/shared/settings-cache/cache');
const publicSettings = require('../../../core/shared/settings-cache/public');
should.equal(true, true);
describe('UNIT: settings cache', function () {
beforeEach(function () {
cache = rewire('../../../../core/server/services/settings/cache');
cache = rewire('../../../core/shared/settings-cache/cache');
});
afterEach(function () {

View File

@ -2,7 +2,7 @@ const should = require('should');
const sinon = require('sinon');
const express = require('../../../../../core/shared/express');
const serveFavicon = require('../../../../../core/server/web/site/middleware/serve-favicon');
const settingsCache = require('../../../../../core/server/services/settings/cache');
const settingsCache = require('../../../../../core/shared/settings-cache');
const storage = require('../../../../../core/server/adapters/storage');
const configUtils = require('../../../../utils/configUtils');
const path = require('path');

View File

@ -5,7 +5,7 @@ const path = require('path');
const models = require('../../core/server/models');
const routingService = require('../../core/frontend/services/routing');
const settingsService = require('../../core/server/services/settings');
const settingsCache = require('../../core/server/services/settings/cache');
const settingsCache = require('../../core/shared/settings-cache');
const imageLib = require('../../core/server/lib/image');
const themeService = require('../../core/server/services/themes');