mirror of
https://github.com/TryGhost/Ghost.git
synced 2024-12-22 02:11:44 +03:00
3b390639c4
refs https://github.com/TryGhost/Toolbox/issues/135 - To be able to reliably start ghost instance without a frontend the process needs access to urls/resources caches - Storing the configuration in "paths" for now as there's no better place for it untill we are able to mock the content folder in pre-boot
23 lines
971 B
JavaScript
23 lines
971 B
JavaScript
const path = require('path');
|
|
const config = require('../../../shared/config');
|
|
const UrlService = require('./UrlService');
|
|
|
|
// NOTE: instead of a path we could give UrlService a "data-resolver" of some sort
|
|
// so it doesn't have to contain the logic to read data at all. This would be
|
|
// a possible improvement in the future
|
|
|
|
let urlsCachePath = path.join(config.getContentPath('data'), 'urls.json');
|
|
let resourcesCachePath = path.join(config.getContentPath('data'), 'resources.json');
|
|
|
|
// TODO: remove this hack in favor of loading from the content path when it's possible to do so
|
|
// by mocking content folders in pre-boot phase
|
|
if (process.env.NODE_ENV.match(/^testing/)){
|
|
urlsCachePath = path.join(config.get('paths').urlCache, 'urls.json');
|
|
resourcesCachePath = path.join(config.get('paths').urlCache, 'resources.json');
|
|
}
|
|
|
|
const urlService = new UrlService({urlsCachePath, resourcesCachePath});
|
|
|
|
// Singleton
|
|
module.exports = urlService;
|