mirror of
https://github.com/TryGhost/Ghost.git
synced 2024-12-21 09:52:06 +03:00
1a3a80cacc
refs https://github.com/TryGhost/Toolbox/issues/127 - The resource cache is needed to have quick and reproducible state of the resouces tied to the urls instead of waiting for the db queries to finish. - Allows to use UrlService without any database connection at all - useful for unit testing
14 lines
617 B
JavaScript
14 lines
617 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
|
|
const urlsCachePath = path.join(config.getContentPath('data'), 'urls.json');
|
|
const resourcesCachePath = path.join(config.getContentPath('data'), 'resources.json');
|
|
const urlService = new UrlService({urlsCachePath, resourcesCachePath});
|
|
|
|
// Singleton
|
|
module.exports = urlService;
|