mirror of
https://github.com/TryGhost/Ghost.git
synced 2024-12-25 20:03:12 +03:00
Revert "Revert "Extract logging from DI patterns, only use @tryghost/logging package"" (#13884)
This reverts commit fa8c3ebe99
.
Reverting the revert, which will allow us to fully switch to @tryghost/logging v2.
This commit is contained in:
parent
5a798c35ba
commit
76f06fae3c
@ -50,16 +50,14 @@ function notifyServerReady(error) {
|
|||||||
/**
|
/**
|
||||||
* Get the Database into a ready state
|
* Get the Database into a ready state
|
||||||
* - DatabaseStateManager handles doing all this for us
|
* - DatabaseStateManager handles doing all this for us
|
||||||
* - Passing logging makes it output state messages
|
|
||||||
*
|
*
|
||||||
* @param {object} options
|
* @param {object} options
|
||||||
* @param {object} options.config
|
* @param {object} options.config
|
||||||
* @param {object} options.logging
|
|
||||||
*/
|
*/
|
||||||
async function initDatabase({config, logging}) {
|
async function initDatabase({config}) {
|
||||||
const DatabaseStateManager = require('./server/data/db/state-manager');
|
const DatabaseStateManager = require('./server/data/db/state-manager');
|
||||||
const dbStateManager = new DatabaseStateManager({knexMigratorFilePath: config.get('paths:appRoot')});
|
const dbStateManager = new DatabaseStateManager({knexMigratorFilePath: config.get('paths:appRoot')});
|
||||||
await dbStateManager.makeReady({logging});
|
await dbStateManager.makeReady();
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -383,7 +381,7 @@ async function bootGhost({backend = true, frontend = true, server = true} = {})
|
|||||||
|
|
||||||
// Step 3 - Get the DB ready
|
// Step 3 - Get the DB ready
|
||||||
debug('Begin: Get DB ready');
|
debug('Begin: Get DB ready');
|
||||||
await initDatabase({config, logging});
|
await initDatabase({config});
|
||||||
bootLogger.log('database ready');
|
bootLogger.log('database ready');
|
||||||
debug('End: Get DB ready');
|
debug('End: Get DB ready');
|
||||||
|
|
||||||
|
@ -1,4 +1,5 @@
|
|||||||
const errors = require('@tryghost/errors');
|
const errors = require('@tryghost/errors');
|
||||||
|
const logging = require('@tryghost/logging');
|
||||||
const fs = require('fs-extra');
|
const fs = require('fs-extra');
|
||||||
const path = require('path');
|
const path = require('path');
|
||||||
const MessageFormat = require('intl-messageformat');
|
const MessageFormat = require('intl-messageformat');
|
||||||
@ -12,17 +13,15 @@ const get = require('lodash/get');
|
|||||||
|
|
||||||
class I18n {
|
class I18n {
|
||||||
/**
|
/**
|
||||||
* @param {objec} [options]
|
* @param {object} [options]
|
||||||
* @param {string} basePath - the base path to the translations directory
|
* @param {string} basePath - the base path to the translations directory
|
||||||
* @param {string} [locale] - a locale string
|
* @param {string} [locale] - a locale string
|
||||||
* @param {{dot|fulltext}} [stringMode] - which mode our translation keys use
|
* @param {{dot|fulltext}} [stringMode] - which mode our translation keys use
|
||||||
* @param {{object}} [logging] - logging method
|
|
||||||
*/
|
*/
|
||||||
constructor(options = {}) {
|
constructor(options = {}) {
|
||||||
this._basePath = options.basePath || __dirname;
|
this._basePath = options.basePath || __dirname;
|
||||||
this._locale = options.locale || this.defaultLocale();
|
this._locale = options.locale || this.defaultLocale();
|
||||||
this._stringMode = options.stringMode || 'dot';
|
this._stringMode = options.stringMode || 'dot';
|
||||||
this._logging = options.logging || console;
|
|
||||||
|
|
||||||
this._strings = null;
|
this._strings = null;
|
||||||
}
|
}
|
||||||
@ -262,34 +261,34 @@ class I18n {
|
|||||||
}
|
}
|
||||||
|
|
||||||
_handleUninitialisedError(key) {
|
_handleUninitialisedError(key) {
|
||||||
this._logging.warn(`i18n was used before it was initialised with key ${key}`);
|
logging.warn(`i18n was used before it was initialised with key ${key}`);
|
||||||
this.init();
|
this.init();
|
||||||
}
|
}
|
||||||
|
|
||||||
_handleFormatError(err) {
|
_handleFormatError(err) {
|
||||||
this._logging.error(err.message);
|
logging.error(err.message);
|
||||||
}
|
}
|
||||||
|
|
||||||
_handleFallbackToDefault() {
|
_handleFallbackToDefault() {
|
||||||
this._logging.warn(`i18n is falling back to ${this.defaultLocale()}.json.`);
|
logging.warn(`i18n is falling back to ${this.defaultLocale()}.json.`);
|
||||||
}
|
}
|
||||||
|
|
||||||
_handleMissingFileError(locale) {
|
_handleMissingFileError(locale) {
|
||||||
this._logging.warn(`i18n was unable to find ${locale}.json.`);
|
logging.warn(`i18n was unable to find ${locale}.json.`);
|
||||||
}
|
}
|
||||||
_handleInvalidFileError(locale, err) {
|
_handleInvalidFileError(locale, err) {
|
||||||
this._logging.error(new errors.IncorrectUsageError({
|
logging.error(new errors.IncorrectUsageError({
|
||||||
err,
|
err,
|
||||||
message: `i18n was unable to parse ${locale}.json. Please check that it is valid JSON.`
|
message: `i18n was unable to parse ${locale}.json. Please check that it is valid JSON.`
|
||||||
}));
|
}));
|
||||||
}
|
}
|
||||||
|
|
||||||
_handleEmptyKeyError() {
|
_handleEmptyKeyError() {
|
||||||
this._logging.warn('i18n.t() was called without a key');
|
logging.warn('i18n.t() was called without a key');
|
||||||
}
|
}
|
||||||
|
|
||||||
_handleMissingKeyError(key) {
|
_handleMissingKeyError(key) {
|
||||||
this._logging.error(new errors.IncorrectUsageError({
|
logging.error(new errors.IncorrectUsageError({
|
||||||
message: `i18n.t() was called with a key that could not be found: ${key}`
|
message: `i18n.t() was called with a key that could not be found: ${key}`
|
||||||
}));
|
}));
|
||||||
}
|
}
|
||||||
|
@ -1,7 +1,6 @@
|
|||||||
const config = require('../../../../shared/config');
|
const config = require('../../../../shared/config');
|
||||||
const logging = require('@tryghost/logging');
|
|
||||||
|
|
||||||
const ThemeI18n = require('./theme-i18n');
|
const ThemeI18n = require('./theme-i18n');
|
||||||
|
|
||||||
module.exports = new ThemeI18n({logging, basePath: config.getContentPath('themes')});
|
module.exports = new ThemeI18n({basePath: config.getContentPath('themes')});
|
||||||
module.exports.ThemeI18n = ThemeI18n;
|
module.exports.ThemeI18n = ThemeI18n;
|
||||||
|
@ -1,4 +1,5 @@
|
|||||||
const errors = require('@tryghost/errors');
|
const errors = require('@tryghost/errors');
|
||||||
|
const logging = require('@tryghost/logging');
|
||||||
const I18n = require('./i18n');
|
const I18n = require('./i18n');
|
||||||
|
|
||||||
class ThemeI18n extends I18n {
|
class ThemeI18n extends I18n {
|
||||||
@ -39,23 +40,23 @@ class ThemeI18n extends I18n {
|
|||||||
}
|
}
|
||||||
|
|
||||||
_handleFallbackToDefault() {
|
_handleFallbackToDefault() {
|
||||||
this._logging.warn(`Theme translations falling back to locales/${this.defaultLocale()}.json.`);
|
logging.warn(`Theme translations falling back to locales/${this.defaultLocale()}.json.`);
|
||||||
}
|
}
|
||||||
|
|
||||||
_handleMissingFileError(locale) {
|
_handleMissingFileError(locale) {
|
||||||
if (locale !== this.defaultLocale()) {
|
if (locale !== this.defaultLocale()) {
|
||||||
this._logging.warn(`Theme translations file locales/${locale}.json not found.`);
|
logging.warn(`Theme translations file locales/${locale}.json not found.`);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
_handleInvalidFileError(locale, err) {
|
_handleInvalidFileError(locale, err) {
|
||||||
this._logging.error(new errors.IncorrectUsageError({
|
logging.error(new errors.IncorrectUsageError({
|
||||||
err,
|
err,
|
||||||
message: `Theme translations unable to parse locales/${locale}.json. Please check that it is valid JSON.`
|
message: `Theme translations unable to parse locales/${locale}.json. Please check that it is valid JSON.`
|
||||||
}));
|
}));
|
||||||
}
|
}
|
||||||
|
|
||||||
_handleEmptyKeyError() {
|
_handleEmptyKeyError() {
|
||||||
this._logging.warn('Theme translations {{t}} helper called without a translation key.');
|
logging.warn('Theme translations {{t}} helper called without a translation key.');
|
||||||
}
|
}
|
||||||
|
|
||||||
_handleMissingKeyError() {
|
_handleMissingKeyError() {
|
||||||
|
@ -15,8 +15,7 @@ const Twitter = require('../../services/twitter-embed');
|
|||||||
const twitter = new Twitter({
|
const twitter = new Twitter({
|
||||||
config: {
|
config: {
|
||||||
bearerToken: config.get('twitter').privateReadOnlyToken
|
bearerToken: config.get('twitter').privateReadOnlyToken
|
||||||
},
|
}
|
||||||
logging: require('@tryghost/logging')
|
|
||||||
});
|
});
|
||||||
|
|
||||||
oembed.registerProvider(nft);
|
oembed.registerProvider(nft);
|
||||||
|
@ -1,5 +1,6 @@
|
|||||||
const KnexMigrator = require('knex-migrator');
|
const KnexMigrator = require('knex-migrator');
|
||||||
const errors = require('@tryghost/errors');
|
const errors = require('@tryghost/errors');
|
||||||
|
const logging = require('@tryghost/logging');
|
||||||
|
|
||||||
const states = {
|
const states = {
|
||||||
READY: 0,
|
READY: 0,
|
||||||
@ -8,7 +9,7 @@ const states = {
|
|||||||
ERROR: 3
|
ERROR: 3
|
||||||
};
|
};
|
||||||
|
|
||||||
const printState = ({state, logging}) => {
|
const printState = ({state}) => {
|
||||||
if (state === states.READY) {
|
if (state === states.READY) {
|
||||||
logging.info('Database is in a ready state.');
|
logging.info('Database is in a ready state.');
|
||||||
}
|
}
|
||||||
@ -67,13 +68,11 @@ class DatabaseStateManager {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
async makeReady({logging}) {
|
async makeReady() {
|
||||||
try {
|
try {
|
||||||
let state = await this.getState();
|
let state = await this.getState();
|
||||||
|
|
||||||
if (logging) {
|
printState({state});
|
||||||
printState({state, logging});
|
|
||||||
}
|
|
||||||
|
|
||||||
if (state === states.READY) {
|
if (state === states.READY) {
|
||||||
return;
|
return;
|
||||||
@ -89,9 +88,7 @@ class DatabaseStateManager {
|
|||||||
|
|
||||||
state = await this.getState();
|
state = await this.getState();
|
||||||
|
|
||||||
if (logging) {
|
printState({state});
|
||||||
printState({state, logging});
|
|
||||||
}
|
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
let errorToThrow = error;
|
let errorToThrow = error;
|
||||||
if (!errors.utils.isGhostError(error)) {
|
if (!errors.utils.isGhostError(error)) {
|
||||||
|
@ -1,9 +1,8 @@
|
|||||||
const debug = require('@tryghost/debug')('utils:image-size-cache');
|
const debug = require('@tryghost/debug')('utils:image-size-cache');
|
||||||
const errors = require('@tryghost/errors');
|
const errors = require('@tryghost/errors');
|
||||||
|
const logging = require('@tryghost/logging');
|
||||||
class CachedImageSizeFromUrl {
|
class CachedImageSizeFromUrl {
|
||||||
constructor({logging, imageSize}) {
|
constructor({imageSize}) {
|
||||||
this.logging = logging;
|
|
||||||
this.imageSize = imageSize;
|
this.imageSize = imageSize;
|
||||||
this.cache = new Map();
|
this.cache = new Map();
|
||||||
}
|
}
|
||||||
@ -37,7 +36,7 @@ class CachedImageSizeFromUrl {
|
|||||||
return this.cache.get(url);
|
return this.cache.get(url);
|
||||||
}).catch((err) => {
|
}).catch((err) => {
|
||||||
debug('Cached image (error):', url);
|
debug('Cached image (error):', url);
|
||||||
this.logging.error(err);
|
logging.error(err);
|
||||||
|
|
||||||
// in case of error we just attach the url
|
// in case of error we just attach the url
|
||||||
this.cache.set(url, url);
|
this.cache.set(url, url);
|
||||||
|
@ -4,10 +4,10 @@ const Gravatar = require('./gravatar');
|
|||||||
const ImageSize = require('./image-size');
|
const ImageSize = require('./image-size');
|
||||||
|
|
||||||
class ImageUtils {
|
class ImageUtils {
|
||||||
constructor({config, logging, urlUtils, settingsCache, storageUtils, storage, validator, request}) {
|
constructor({config, urlUtils, settingsCache, storageUtils, storage, validator, request}) {
|
||||||
this.blogIcon = new BlogIcon({config, urlUtils, settingsCache, storageUtils});
|
this.blogIcon = new BlogIcon({config, urlUtils, settingsCache, storageUtils});
|
||||||
this.imageSize = new ImageSize({config, storage, storageUtils, validator, urlUtils, request});
|
this.imageSize = new ImageSize({config, storage, storageUtils, validator, urlUtils, request});
|
||||||
this.cachedImageSizeFromUrl = new CachedImageSizeFromUrl({logging, imageSize: this.imageSize});
|
this.cachedImageSizeFromUrl = new CachedImageSizeFromUrl({imageSize: this.imageSize});
|
||||||
this.gravatar = new Gravatar({config, request});
|
this.gravatar = new Gravatar({config, request});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -4,8 +4,7 @@ const storage = require('../../adapters/storage');
|
|||||||
const storageUtils = require('../../adapters/storage/utils');
|
const storageUtils = require('../../adapters/storage/utils');
|
||||||
const validator = require('@tryghost/validator');
|
const validator = require('@tryghost/validator');
|
||||||
const config = require('../../../shared/config');
|
const config = require('../../../shared/config');
|
||||||
const logging = require('@tryghost/logging');
|
|
||||||
const settingsCache = require('../../../shared/settings-cache');
|
const settingsCache = require('../../../shared/settings-cache');
|
||||||
const ImageUtils = require('./image-utils');
|
const ImageUtils = require('./image-utils');
|
||||||
|
|
||||||
module.exports = new ImageUtils({config, logging, urlUtils, settingsCache, storageUtils, storage, validator, request});
|
module.exports = new ImageUtils({config, urlUtils, settingsCache, storageUtils, storage, validator, request});
|
||||||
|
@ -31,18 +31,6 @@ if (parentPort) {
|
|||||||
(async () => {
|
(async () => {
|
||||||
const updateCheck = require('./update-check');
|
const updateCheck = require('./update-check');
|
||||||
|
|
||||||
const logging = {
|
|
||||||
info(message) {
|
|
||||||
postParentPortMessage(message);
|
|
||||||
},
|
|
||||||
warn(message) {
|
|
||||||
postParentPortMessage(message);
|
|
||||||
},
|
|
||||||
error(message) {
|
|
||||||
postParentPortMessage(message);
|
|
||||||
}
|
|
||||||
};
|
|
||||||
|
|
||||||
// INIT required services
|
// INIT required services
|
||||||
const models = require('./models');
|
const models = require('./models');
|
||||||
models.init();
|
models.init();
|
||||||
@ -54,7 +42,7 @@ if (parentPort) {
|
|||||||
await settings.init();
|
await settings.init();
|
||||||
// Finished INIT
|
// Finished INIT
|
||||||
|
|
||||||
await updateCheck({logging});
|
await updateCheck();
|
||||||
|
|
||||||
postParentPortMessage(`Ran update check`);
|
postParentPortMessage(`Ran update check`);
|
||||||
|
|
||||||
|
@ -1,5 +1,4 @@
|
|||||||
const config = require('../../../shared/config');
|
const config = require('../../../shared/config');
|
||||||
const logging = require('@tryghost/logging');
|
|
||||||
const db = require('../../data/db');
|
const db = require('../../data/db');
|
||||||
const settings = require('../../../shared/settings-cache');
|
const settings = require('../../../shared/settings-cache');
|
||||||
const {EmailAnalyticsService} = require('@tryghost/email-analytics-service');
|
const {EmailAnalyticsService} = require('@tryghost/email-analytics-service');
|
||||||
@ -9,11 +8,10 @@ const queries = require('./lib/queries');
|
|||||||
|
|
||||||
module.exports = new EmailAnalyticsService({
|
module.exports = new EmailAnalyticsService({
|
||||||
config,
|
config,
|
||||||
logging,
|
|
||||||
settings,
|
settings,
|
||||||
eventProcessor: new EventProcessor({db, logging}),
|
eventProcessor: new EventProcessor({db}),
|
||||||
providers: [
|
providers: [
|
||||||
new MailgunProvider({config, settings, logging})
|
new MailgunProvider({config, settings})
|
||||||
],
|
],
|
||||||
queries
|
queries
|
||||||
});
|
});
|
||||||
|
@ -28,24 +28,6 @@ if (parentPort) {
|
|||||||
const config = require('../../../../shared/config');
|
const config = require('../../../../shared/config');
|
||||||
const db = require('../../../data/db');
|
const db = require('../../../data/db');
|
||||||
|
|
||||||
const logging = {
|
|
||||||
info(message) {
|
|
||||||
if (parentPort) {
|
|
||||||
parentPort.postMessage(message);
|
|
||||||
}
|
|
||||||
},
|
|
||||||
warn(message) {
|
|
||||||
if (parentPort) {
|
|
||||||
parentPort.postMessage(message);
|
|
||||||
}
|
|
||||||
},
|
|
||||||
error(message) {
|
|
||||||
if (parentPort) {
|
|
||||||
parentPort.postMessage(message);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
};
|
|
||||||
|
|
||||||
const settingsRows = await db.knex('settings')
|
const settingsRows = await db.knex('settings')
|
||||||
.whereIn('key', ['mailgun_api_key', 'mailgun_domain', 'mailgun_base_url']);
|
.whereIn('key', ['mailgun_api_key', 'mailgun_domain', 'mailgun_base_url']);
|
||||||
|
|
||||||
@ -69,10 +51,9 @@ if (parentPort) {
|
|||||||
const emailAnalyticsService = new EmailAnalyticsService({
|
const emailAnalyticsService = new EmailAnalyticsService({
|
||||||
config,
|
config,
|
||||||
settings,
|
settings,
|
||||||
logging,
|
eventProcessor: new EventProcessor({db}),
|
||||||
eventProcessor: new EventProcessor({db, logging}),
|
|
||||||
providers: [
|
providers: [
|
||||||
new MailgunProvider({config, settings, logging})
|
new MailgunProvider({config, settings})
|
||||||
],
|
],
|
||||||
queries
|
queries
|
||||||
});
|
});
|
||||||
|
@ -1,12 +1,10 @@
|
|||||||
const settingsCache = require('../../../shared/settings-cache');
|
const settingsCache = require('../../../shared/settings-cache');
|
||||||
const mailService = require('../../services/mail');
|
const mailService = require('../../services/mail');
|
||||||
const logging = require('@tryghost/logging');
|
|
||||||
const urlUtils = require('../../../shared/url-utils');
|
const urlUtils = require('../../../shared/url-utils');
|
||||||
const Invites = require('./invites');
|
const Invites = require('./invites');
|
||||||
|
|
||||||
module.exports = new Invites({
|
module.exports = new Invites({
|
||||||
settingsCache,
|
settingsCache,
|
||||||
logging,
|
|
||||||
mailService,
|
mailService,
|
||||||
urlUtils
|
urlUtils
|
||||||
});
|
});
|
||||||
|
@ -1,5 +1,6 @@
|
|||||||
const security = require('@tryghost/security');
|
const security = require('@tryghost/security');
|
||||||
const tpl = require('@tryghost/tpl');
|
const tpl = require('@tryghost/tpl');
|
||||||
|
const logging = require('@tryghost/logging');
|
||||||
|
|
||||||
const messages = {
|
const messages = {
|
||||||
invitedByName: '{invitedByName} has invited you to join {blogName}',
|
invitedByName: '{invitedByName} has invited you to join {blogName}',
|
||||||
@ -10,9 +11,8 @@ const messages = {
|
|||||||
};
|
};
|
||||||
|
|
||||||
class Invites {
|
class Invites {
|
||||||
constructor({settingsCache, logging, mailService, urlUtils}) {
|
constructor({settingsCache, mailService, urlUtils}) {
|
||||||
this.settingsCache = settingsCache;
|
this.settingsCache = settingsCache;
|
||||||
this.logging = logging;
|
|
||||||
this.mailService = mailService;
|
this.mailService = mailService;
|
||||||
this.urlUtils = urlUtils;
|
this.urlUtils = urlUtils;
|
||||||
}
|
}
|
||||||
@ -80,7 +80,7 @@ class Invites {
|
|||||||
});
|
});
|
||||||
const helpText = tpl(messages.errorSendingEmail.help);
|
const helpText = tpl(messages.errorSendingEmail.help);
|
||||||
err.message = `${errorMessage} ${helpText}`;
|
err.message = `${errorMessage} ${helpText}`;
|
||||||
this.logging.warn(err.message);
|
logging.warn(err.message);
|
||||||
}
|
}
|
||||||
|
|
||||||
return Promise.reject(err);
|
return Promise.reject(err);
|
||||||
|
@ -17,6 +17,6 @@ const workerMessageHandler = ({name, message}) => {
|
|||||||
logging.info(`Worker for job ${name} sent a message: ${message}`);
|
logging.info(`Worker for job ${name} sent a message: ${message}`);
|
||||||
};
|
};
|
||||||
|
|
||||||
const jobManager = new JobManager({logging, errorHandler, workerMessageHandler});
|
const jobManager = new JobManager({errorHandler, workerMessageHandler});
|
||||||
|
|
||||||
module.exports = jobManager;
|
module.exports = jobManager;
|
||||||
|
@ -207,7 +207,6 @@ function createApiInstance(config) {
|
|||||||
Settings: models.Settings
|
Settings: models.Settings
|
||||||
},
|
},
|
||||||
stripeAPIService: stripeService.api,
|
stripeAPIService: stripeService.api,
|
||||||
logger: logging,
|
|
||||||
offersAPI: offersService.api,
|
offersAPI: offersService.api,
|
||||||
labsService: labsService
|
labsService: labsService
|
||||||
});
|
});
|
||||||
|
@ -1,4 +1,5 @@
|
|||||||
const errors = require('@tryghost/errors');
|
const errors = require('@tryghost/errors');
|
||||||
|
const logging = require('@tryghost/logging');
|
||||||
const tpl = require('@tryghost/tpl');
|
const tpl = require('@tryghost/tpl');
|
||||||
const {URL} = require('url');
|
const {URL} = require('url');
|
||||||
const crypto = require('crypto');
|
const crypto = require('crypto');
|
||||||
@ -22,7 +23,6 @@ class MembersConfigProvider {
|
|||||||
this._settingsCache = options.settingsCache;
|
this._settingsCache = options.settingsCache;
|
||||||
this._config = options.config;
|
this._config = options.config;
|
||||||
this._urlUtils = options.urlUtils;
|
this._urlUtils = options.urlUtils;
|
||||||
this._logging = options.logging;
|
|
||||||
this._ghostVersion = options.ghostVersion;
|
this._ghostVersion = options.ghostVersion;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -193,12 +193,12 @@ class MembersConfigProvider {
|
|||||||
getAuthSecret() {
|
getAuthSecret() {
|
||||||
const hexSecret = this._settingsCache.get('members_email_auth_secret');
|
const hexSecret = this._settingsCache.get('members_email_auth_secret');
|
||||||
if (!hexSecret) {
|
if (!hexSecret) {
|
||||||
this._logging.warn('Could not find members_email_auth_secret, using dynamically generated secret');
|
logging.warn('Could not find members_email_auth_secret, using dynamically generated secret');
|
||||||
return crypto.randomBytes(64);
|
return crypto.randomBytes(64);
|
||||||
}
|
}
|
||||||
const secret = Buffer.from(hexSecret, 'hex');
|
const secret = Buffer.from(hexSecret, 'hex');
|
||||||
if (secret.length < 64) {
|
if (secret.length < 64) {
|
||||||
this._logging.warn('members_email_auth_secret not large enough (64 bytes), using dynamically generated secret');
|
logging.warn('members_email_auth_secret not large enough (64 bytes), using dynamically generated secret');
|
||||||
return crypto.randomBytes(64);
|
return crypto.randomBytes(64);
|
||||||
}
|
}
|
||||||
return secret;
|
return secret;
|
||||||
@ -236,7 +236,7 @@ class MembersConfigProvider {
|
|||||||
let publicKey = this._settingsCache.get('members_public_key');
|
let publicKey = this._settingsCache.get('members_public_key');
|
||||||
|
|
||||||
if (!privateKey || !publicKey) {
|
if (!privateKey || !publicKey) {
|
||||||
this._logging.warn('Could not find members_private_key, using dynamically generated keypair');
|
logging.warn('Could not find members_private_key, using dynamically generated keypair');
|
||||||
const keypair = createKeypair({bits: 1024});
|
const keypair = createKeypair({bits: 1024});
|
||||||
privateKey = keypair.private;
|
privateKey = keypair.private;
|
||||||
publicKey = keypair.public;
|
publicKey = keypair.public;
|
||||||
|
@ -36,7 +36,6 @@ const membersConfig = new MembersConfigProvider({
|
|||||||
config,
|
config,
|
||||||
settingsCache,
|
settingsCache,
|
||||||
urlUtils,
|
urlUtils,
|
||||||
logging,
|
|
||||||
ghostVersion
|
ghostVersion
|
||||||
});
|
});
|
||||||
|
|
||||||
|
@ -1,5 +1,4 @@
|
|||||||
const _ = require('lodash');
|
const _ = require('lodash');
|
||||||
const logging = require('@tryghost/logging');
|
|
||||||
const StripeAPIService = require('@tryghost/members-stripe-service');
|
const StripeAPIService = require('@tryghost/members-stripe-service');
|
||||||
|
|
||||||
const config = require('../../../shared/config');
|
const config = require('../../../shared/config');
|
||||||
@ -9,7 +8,6 @@ const events = require('../../lib/common/events');
|
|||||||
const {getConfig} = require('./config');
|
const {getConfig} = require('./config');
|
||||||
|
|
||||||
const api = new StripeAPIService({
|
const api = new StripeAPIService({
|
||||||
logger: logging,
|
|
||||||
config: {}
|
config: {}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
@ -1,4 +1,5 @@
|
|||||||
const {extract} = require('oembed-parser');
|
const {extract} = require('oembed-parser');
|
||||||
|
const logging = require('@tryghost/logging');
|
||||||
const labs = require('../../shared/labs');
|
const labs = require('../../shared/labs');
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -69,7 +70,7 @@ class TwitterOEmbedProvider {
|
|||||||
oembedData.tweet_data = body.data;
|
oembedData.tweet_data = body.data;
|
||||||
oembedData.tweet_data.includes = body.includes;
|
oembedData.tweet_data.includes = body.includes;
|
||||||
} catch (err) {
|
} catch (err) {
|
||||||
this.dependencies.logging.error(err);
|
logging.error(err);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
12
package.json
12
package.json
@ -58,26 +58,26 @@
|
|||||||
"@tryghost/adapter-manager": "0.2.24",
|
"@tryghost/adapter-manager": "0.2.24",
|
||||||
"@tryghost/admin-api-schema": "2.6.1",
|
"@tryghost/admin-api-schema": "2.6.1",
|
||||||
"@tryghost/bookshelf-plugins": "0.3.5",
|
"@tryghost/bookshelf-plugins": "0.3.5",
|
||||||
"@tryghost/bootstrap-socket": "0.2.14",
|
"@tryghost/bootstrap-socket": "0.2.15",
|
||||||
"@tryghost/color-utils": "0.1.5",
|
"@tryghost/color-utils": "0.1.5",
|
||||||
"@tryghost/config-url-helpers": "0.1.3",
|
"@tryghost/config-url-helpers": "0.1.3",
|
||||||
"@tryghost/constants": "1.0.0",
|
"@tryghost/constants": "1.0.0",
|
||||||
"@tryghost/custom-theme-settings-service": "0.3.1",
|
"@tryghost/custom-theme-settings-service": "0.3.1",
|
||||||
"@tryghost/debug": "0.1.9",
|
"@tryghost/debug": "0.1.9",
|
||||||
"@tryghost/email-analytics-provider-mailgun": "1.0.6",
|
"@tryghost/email-analytics-provider-mailgun": "1.0.7",
|
||||||
"@tryghost/email-analytics-service": "1.0.5",
|
"@tryghost/email-analytics-service": "1.0.5",
|
||||||
"@tryghost/errors": "1.0.4",
|
"@tryghost/errors": "1.1.1",
|
||||||
"@tryghost/express-dynamic-redirects": "0.2.2",
|
"@tryghost/express-dynamic-redirects": "0.2.2",
|
||||||
"@tryghost/helpers": "1.1.54",
|
"@tryghost/helpers": "1.1.54",
|
||||||
"@tryghost/image-transform": "1.0.24",
|
"@tryghost/image-transform": "1.0.24",
|
||||||
"@tryghost/job-manager": "0.8.16",
|
"@tryghost/job-manager": "0.8.17",
|
||||||
"@tryghost/kg-card-factory": "3.1.0",
|
"@tryghost/kg-card-factory": "3.1.0",
|
||||||
"@tryghost/kg-default-atoms": "3.1.0",
|
"@tryghost/kg-default-atoms": "3.1.0",
|
||||||
"@tryghost/kg-default-cards": "5.14.2",
|
"@tryghost/kg-default-cards": "5.14.2",
|
||||||
"@tryghost/kg-markdown-html-renderer": "5.1.0",
|
"@tryghost/kg-markdown-html-renderer": "5.1.0",
|
||||||
"@tryghost/kg-mobiledoc-html-renderer": "5.3.1",
|
"@tryghost/kg-mobiledoc-html-renderer": "5.3.1",
|
||||||
"@tryghost/limit-service": "1.0.6",
|
"@tryghost/limit-service": "1.0.6",
|
||||||
"@tryghost/logging": "1.0.2",
|
"@tryghost/logging": "2.0.0",
|
||||||
"@tryghost/magic-link": "1.0.14",
|
"@tryghost/magic-link": "1.0.14",
|
||||||
"@tryghost/members-api": "2.8.6",
|
"@tryghost/members-api": "2.8.6",
|
||||||
"@tryghost/members-csv": "1.2.0",
|
"@tryghost/members-csv": "1.2.0",
|
||||||
@ -98,7 +98,7 @@
|
|||||||
"@tryghost/social-urls": "0.1.27",
|
"@tryghost/social-urls": "0.1.27",
|
||||||
"@tryghost/string": "0.1.21",
|
"@tryghost/string": "0.1.21",
|
||||||
"@tryghost/tpl": "0.1.8",
|
"@tryghost/tpl": "0.1.8",
|
||||||
"@tryghost/update-check-service": "0.2.5",
|
"@tryghost/update-check-service": "0.3.0",
|
||||||
"@tryghost/url-utils": "2.0.4",
|
"@tryghost/url-utils": "2.0.4",
|
||||||
"@tryghost/validator": "0.1.9",
|
"@tryghost/validator": "0.1.9",
|
||||||
"@tryghost/version": "0.1.7",
|
"@tryghost/version": "0.1.7",
|
||||||
|
58
yarn.lock
58
yarn.lock
@ -1317,12 +1317,12 @@
|
|||||||
resolved "https://registry.npmjs.org/@tryghost/bookshelf-transaction-events/-/bookshelf-transaction-events-0.1.7.tgz"
|
resolved "https://registry.npmjs.org/@tryghost/bookshelf-transaction-events/-/bookshelf-transaction-events-0.1.7.tgz"
|
||||||
integrity sha512-j1hbi+NPaUFhHYAVCWJoUmmIrnD5iSR3UP4nvYnYwCAHQ0Xu4Rc3+kIpdcrnSvwIEJNtVxNCaSarJTK/D/a0JQ==
|
integrity sha512-j1hbi+NPaUFhHYAVCWJoUmmIrnD5iSR3UP4nvYnYwCAHQ0Xu4Rc3+kIpdcrnSvwIEJNtVxNCaSarJTK/D/a0JQ==
|
||||||
|
|
||||||
"@tryghost/bootstrap-socket@0.2.14":
|
"@tryghost/bootstrap-socket@0.2.15":
|
||||||
version "0.2.14"
|
version "0.2.15"
|
||||||
resolved "https://registry.yarnpkg.com/@tryghost/bootstrap-socket/-/bootstrap-socket-0.2.14.tgz#d03caf3f51cd2acf37f0c3ee5cd511a953993197"
|
resolved "https://registry.yarnpkg.com/@tryghost/bootstrap-socket/-/bootstrap-socket-0.2.15.tgz#02b6a3f1408acfd8df88f6a72e197c7e5ffc3bc2"
|
||||||
integrity sha512-95dYoV8EfQg7g2iF750xLJv/Yli1HhcZb3Zl6Nty8rX1GhZ8vFn57Agmh180MyFhO87oXRzihYRn18LAcEH6Ng==
|
integrity sha512-OSWF9JVjfoufUyDi5MTNJb/Zd10yferDSR3cdfxK6Nu/zc8cjzmlKgxtHtsUn7E/mLmERDt4iNk9hC4r1utcIg==
|
||||||
dependencies:
|
dependencies:
|
||||||
"@tryghost/logging" "^1.0.2"
|
"@tryghost/logging" "^2.0.0"
|
||||||
|
|
||||||
"@tryghost/bunyan-rotating-filestream@0.0.7", "@tryghost/bunyan-rotating-filestream@^0.0.7":
|
"@tryghost/bunyan-rotating-filestream@0.0.7", "@tryghost/bunyan-rotating-filestream@^0.0.7":
|
||||||
version "0.0.7"
|
version "0.0.7"
|
||||||
@ -1394,13 +1394,13 @@
|
|||||||
"@elastic/elasticsearch" "^7.15.0"
|
"@elastic/elasticsearch" "^7.15.0"
|
||||||
"@tryghost/debug" "^0.1.9"
|
"@tryghost/debug" "^0.1.9"
|
||||||
|
|
||||||
"@tryghost/email-analytics-provider-mailgun@1.0.6":
|
"@tryghost/email-analytics-provider-mailgun@1.0.7":
|
||||||
version "1.0.6"
|
version "1.0.7"
|
||||||
resolved "https://registry.yarnpkg.com/@tryghost/email-analytics-provider-mailgun/-/email-analytics-provider-mailgun-1.0.6.tgz#7897699cb9054c8c35844bd38c5994103cbf1569"
|
resolved "https://registry.yarnpkg.com/@tryghost/email-analytics-provider-mailgun/-/email-analytics-provider-mailgun-1.0.7.tgz#e8b0da0f9f137ad90b7eb8ee031be88a66811e06"
|
||||||
integrity sha512-41owQfyrDke937FUk68osbi4n+6TZI4EfcH8+Kf6MkGfLy8xt42idk7QCQE+l++YKcENOkknSce+biAkGtmnkw==
|
integrity sha512-OD4spZ0FmRPcIL5+DXE5N+HV26eyIC39yZwXKoQTZFPfU7LvTbbF/hJOFXC/CK4+DT8gd5flXZ32v0o6FUIinA==
|
||||||
dependencies:
|
dependencies:
|
||||||
"@tryghost/email-analytics-service" "^1.0.5"
|
"@tryghost/email-analytics-service" "^1.0.5"
|
||||||
"@tryghost/logging" "^1.0.2"
|
"@tryghost/logging" "^2.0.0"
|
||||||
mailgun-js "^0.22.0"
|
mailgun-js "^0.22.0"
|
||||||
moment "^2.29.1"
|
moment "^2.29.1"
|
||||||
|
|
||||||
@ -1412,10 +1412,10 @@
|
|||||||
"@tryghost/debug" "^0.1.9"
|
"@tryghost/debug" "^0.1.9"
|
||||||
lodash "^4.17.20"
|
lodash "^4.17.20"
|
||||||
|
|
||||||
"@tryghost/errors@1.0.4", "@tryghost/errors@^1.0.0":
|
"@tryghost/errors@1.1.1", "@tryghost/errors@^1.0.0", "@tryghost/errors@^1.1.0", "@tryghost/errors@^1.1.1":
|
||||||
version "1.0.4"
|
version "1.1.1"
|
||||||
resolved "https://registry.npmjs.org/@tryghost/errors/-/errors-1.0.4.tgz"
|
resolved "https://registry.npmjs.org/@tryghost/errors/-/errors-1.1.1.tgz"
|
||||||
integrity sha512-ImfwkOc54Ur9zjYgPaG3Y9wFeH00eJnqClYBZSB5/K0T6nqTXnIOyFIq33vZkmXuxQLX1xRb82OeWYxHxgFWDA==
|
integrity sha512-na0qB5sdy1BWgquzn+m530ohJ3fTeF451xUTR7I8b76TBEL9snnIkXCv5Qdjmnevmgod7aAGsHi2syyKFlvEvQ==
|
||||||
dependencies:
|
dependencies:
|
||||||
lodash "^4.17.21"
|
lodash "^4.17.21"
|
||||||
uuid "^8.3.2"
|
uuid "^8.3.2"
|
||||||
@ -1428,14 +1428,6 @@
|
|||||||
"@tryghost/ignition-errors" "^0.1.0"
|
"@tryghost/ignition-errors" "^0.1.0"
|
||||||
lodash "^4.17.21"
|
lodash "^4.17.21"
|
||||||
|
|
||||||
"@tryghost/errors@^1.1.0", "@tryghost/errors@^1.1.1":
|
|
||||||
version "1.1.1"
|
|
||||||
resolved "https://registry.npmjs.org/@tryghost/errors/-/errors-1.1.1.tgz"
|
|
||||||
integrity sha512-na0qB5sdy1BWgquzn+m530ohJ3fTeF451xUTR7I8b76TBEL9snnIkXCv5Qdjmnevmgod7aAGsHi2syyKFlvEvQ==
|
|
||||||
dependencies:
|
|
||||||
lodash "^4.17.21"
|
|
||||||
uuid "^8.3.2"
|
|
||||||
|
|
||||||
"@tryghost/express-dynamic-redirects@0.2.2":
|
"@tryghost/express-dynamic-redirects@0.2.2":
|
||||||
version "0.2.2"
|
version "0.2.2"
|
||||||
resolved "https://registry.npmjs.org/@tryghost/express-dynamic-redirects/-/express-dynamic-redirects-0.2.2.tgz"
|
resolved "https://registry.npmjs.org/@tryghost/express-dynamic-redirects/-/express-dynamic-redirects-0.2.2.tgz"
|
||||||
@ -1476,13 +1468,13 @@
|
|||||||
optionalDependencies:
|
optionalDependencies:
|
||||||
sharp "^0.29.0"
|
sharp "^0.29.0"
|
||||||
|
|
||||||
"@tryghost/job-manager@0.8.16":
|
"@tryghost/job-manager@0.8.17":
|
||||||
version "0.8.16"
|
version "0.8.17"
|
||||||
resolved "https://registry.yarnpkg.com/@tryghost/job-manager/-/job-manager-0.8.16.tgz#bd97b86fa72d564f08d7f00b5783e18685aab84c"
|
resolved "https://registry.yarnpkg.com/@tryghost/job-manager/-/job-manager-0.8.17.tgz#356d91de13a48122e7bd178d038a9f759a499e22"
|
||||||
integrity sha512-4xfrkMdn2UHI/BFERAckoIsTgPepekvCDXykU/OLrkwbkqrChj+G6gL3EIGjjilSB6wzmJQ0BNinOn2o6M+NJQ==
|
integrity sha512-srtey6RC89K5e2ai5zdTldpoKUvTdKilrUyuAc40tvpzBOct8K8o+mTIN2Ak+Yw8pre00WO/qcnuUTkTca4I5w==
|
||||||
dependencies:
|
dependencies:
|
||||||
"@breejs/later" "^4.0.2"
|
"@breejs/later" "^4.0.2"
|
||||||
"@tryghost/logging" "^1.0.2"
|
"@tryghost/logging" "^2.0.0"
|
||||||
bree "^6.2.0"
|
bree "^6.2.0"
|
||||||
cron-validate "^1.4.3"
|
cron-validate "^1.4.3"
|
||||||
fastq "^1.11.0"
|
fastq "^1.11.0"
|
||||||
@ -1552,7 +1544,7 @@
|
|||||||
lodash "^4.17.21"
|
lodash "^4.17.21"
|
||||||
luxon "^1.26.0"
|
luxon "^1.26.0"
|
||||||
|
|
||||||
"@tryghost/logging@1.0.2", "@tryghost/logging@2.0.0", "@tryghost/logging@^1.0.0", "@tryghost/logging@^1.0.2", "@tryghost/logging@^2.0.0":
|
"@tryghost/logging@1.0.2", "@tryghost/logging@2.0.0", "@tryghost/logging@^1.0.0", "@tryghost/logging@^2.0.0":
|
||||||
version "2.0.0"
|
version "2.0.0"
|
||||||
resolved "https://registry.yarnpkg.com/@tryghost/logging/-/logging-2.0.0.tgz#587c579d703ef15fe468b8bb8efdd9cdfefb90ef"
|
resolved "https://registry.yarnpkg.com/@tryghost/logging/-/logging-2.0.0.tgz#587c579d703ef15fe468b8bb8efdd9cdfefb90ef"
|
||||||
integrity sha512-eWKtiHWDtVVf+xn+ecKb8mUepFDK1RXOhl1tFMF1b7eFASn5WIDLFSMH9Xl9gyCi6dnsXp5fAm2G3baZ77bPZg==
|
integrity sha512-eWKtiHWDtVVf+xn+ecKb8mUepFDK1RXOhl1tFMF1b7eFASn5WIDLFSMH9Xl9gyCi6dnsXp5fAm2G3baZ77bPZg==
|
||||||
@ -1851,14 +1843,14 @@
|
|||||||
dependencies:
|
dependencies:
|
||||||
lodash.template "^4.5.0"
|
lodash.template "^4.5.0"
|
||||||
|
|
||||||
"@tryghost/update-check-service@0.2.5":
|
"@tryghost/update-check-service@0.3.0":
|
||||||
version "0.2.5"
|
version "0.3.0"
|
||||||
resolved "https://registry.npmjs.org/@tryghost/update-check-service/-/update-check-service-0.2.5.tgz"
|
resolved "https://registry.yarnpkg.com/@tryghost/update-check-service/-/update-check-service-0.3.0.tgz#0483160e0c6df5361d5fbffc522a44a6f14895ef"
|
||||||
integrity sha512-LdvSpwtnsOX/il5v5VAoFFQc8V1mUsVqKptW/mvsvfMAEVnVtNHXAL0hZry/TDeq+4IU0h2UX+/Ziul8Wf4amA==
|
integrity sha512-Io0e5S0eF9foTlZ7pH5hemDQiDKrl52TSGm+a6XG1a237LwunS8y0KPcz5FUzuPU5FhExQ1AXMnPjjTA3E06Qw==
|
||||||
dependencies:
|
dependencies:
|
||||||
"@tryghost/debug" "^0.1.5"
|
"@tryghost/debug" "^0.1.5"
|
||||||
"@tryghost/errors" "^0.2.11"
|
"@tryghost/errors" "^0.2.11"
|
||||||
"@tryghost/logging" "^1.0.0"
|
"@tryghost/logging" "^2.0.0"
|
||||||
"@tryghost/tpl" "^0.1.3"
|
"@tryghost/tpl" "^0.1.3"
|
||||||
bluebird "^3.7.2"
|
bluebird "^3.7.2"
|
||||||
lodash "^4.17.21"
|
lodash "^4.17.21"
|
||||||
|
Loading…
Reference in New Issue
Block a user