mirror of
https://github.com/TryGhost/Ghost.git
synced 2025-01-06 22:40:14 -05:00
Introduced booting from fixture url cache in test environment
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
This commit is contained in:
parent
c12ae81ece
commit
3b390639c4
4 changed files with 19 additions and 4 deletions
|
@ -5,8 +5,17 @@ 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');
|
||||
|
||||
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
|
||||
|
|
|
@ -50,5 +50,9 @@
|
|||
"useTinfoil": true,
|
||||
"useStructuredData": true
|
||||
},
|
||||
"useMinFiles": false
|
||||
"useMinFiles": false,
|
||||
"paths": {
|
||||
"fixtures": "test/utils/fixtures/fixtures",
|
||||
"urlCache": "test/utils/fixtures/urls"
|
||||
}
|
||||
}
|
||||
|
|
3
core/shared/config/env/config.testing.json
vendored
3
core/shared/config/env/config.testing.json
vendored
|
@ -51,6 +51,7 @@
|
|||
},
|
||||
"useMinFiles": false,
|
||||
"paths": {
|
||||
"fixtures": "test/utils/fixtures/fixtures"
|
||||
"fixtures": "test/utils/fixtures/fixtures",
|
||||
"urlCache": "test/utils/fixtures/urls"
|
||||
}
|
||||
}
|
||||
|
|
|
@ -97,6 +97,7 @@ describe('Config Loader', function () {
|
|||
'contentPath',
|
||||
'fixtures',
|
||||
'assetSrc',
|
||||
'urlCache',
|
||||
'appRoot',
|
||||
'corePath',
|
||||
'clientAssets',
|
||||
|
|
Loading…
Reference in a new issue