0
Fork 0
mirror of https://github.com/TryGhost/Ghost.git synced 2025-01-20 22:42:53 -05:00
ghost/core/server/settings/index.js
Hannah Wolfe 63723aa36a 🎨 Move settings cache & cleanup settings API (#8057)
closes #8037

🔥 Remove API-level default settings population
- This is a relic!
- We ALWAYS populate defaults on server start therefore this code could never run.
- This was a lot of complicated code that wasn't even needed!!

🎨 Move settings cache
- Move settings cache to be its own thing
- Update all references
- Adds TODOs for further cleanup

🎨 Create settings initialisation step
- Create new settings library, which will eventually house more code
- Unify the interface for initialising settings (will be more useful later)
- Reduce number of calls to updateSettingsCache
2017-02-27 16:53:04 +01:00

23 lines
685 B
JavaScript

/**
* Settings Lib
* A collection of utilities for handling settings including a cache
* @TODO: eventually much of this logic will move into this lib
* For now we are providing a unified interface
*/
var SettingsModel = require('../models/settings').Settings,
SettingsAPI = require('../api').settings,
SettingsCache = require('./cache');
module.exports = {
init: function init() {
// Bind to events
SettingsCache.init();
// Update the defaults
return SettingsModel.populateDefaults()
.then(function () {
// Reset the cache
return SettingsAPI.updateSettingsCache();
});
}
};