Restructured public settings cache hash

refs https://github.com/TryGhost/Team/issues/509

- Flipping around key/newKey pair allows to map multiple keys to the same field in the settings
- This becomes handy when there's a need to deprecate a field. For example, we are about to introduce a 'locale' setting which would need to map to 'lang' db key, with current structure it's impossible to have many:1 mapping because it's impossible to have duplicate keys in the JS object ("hash")
This commit is contained in:
Naz 2021-03-04 15:24:08 +13:00
parent 2e2d185087
commit c2a3297f5d

View File

@ -99,7 +99,7 @@ module.exports = {
getPublic() { getPublic() {
let settings = {}; let settings = {};
_.each(publicSettings, (newKey, key) => { _.each(publicSettings, (key, newKey) => {
settings[newKey] = doGet(key) || null; settings[newKey] = doGet(key) || null;
}); });