mirror of
https://github.com/TryGhost/Ghost.git
synced 2024-12-22 18:31:57 +03:00
a5ab2ffc13
no issue 🔥 Remove unnecessary cache update 🎨 simplify updateSettingsCache() 🎨 Simplify readSettingsResult - although this is more code, it's now much clearer what happens in the two cases 🎨 Don't use readSettingResult for edit 🎨 Simplify updateSettingsCache further 🔥 Remove now unused readSettingsResult 🎨 Change populateDefault to return all 🎨 Move the findAll call out of updateSettingsCache 🔥 Remove updateSettingsCache!! 🎨 Restructure init & finish up settingsCache - move initialisation into settingsCache.init AT LAST - change settingCache to use cloneDeep, so that the object can't be modified outside of the functions - add lots of docs to settings cache 🎨 Cleanup db api endpoints 🔥 Don't populate settings in migrations
20 lines
572 B
JavaScript
20 lines
572 B
JavaScript
/**
|
|
* Settings Lib
|
|
* A collection of utilities for handling settings including a cache
|
|
*/
|
|
|
|
var SettingsModel = require('../models/settings').Settings,
|
|
SettingsCache = require('./cache');
|
|
|
|
module.exports = {
|
|
init: function init() {
|
|
// Update the defaults
|
|
return SettingsModel.populateDefaults()
|
|
.then(function (settingsCollection) {
|
|
// Initialise the cache with the result
|
|
// This will bind to events for further updates
|
|
SettingsCache.init(settingsCollection);
|
|
});
|
|
}
|
|
};
|