rename change notifiers to have handle prefix

This commit is contained in:
Girish Ramakrishnan
2023-08-04 11:43:39 +05:30
parent e73b75e4b5
commit da73067315
5 changed files with 12 additions and 49 deletions
-17
View File
@@ -4,7 +4,6 @@ exports = module.exports = {
getRegistryConfig,
setRegistryConfig,
list,
initCache,
// these values come from the cache
@@ -82,11 +81,9 @@ exports = module.exports = {
};
const assert = require('assert'),
cron = require('./cron.js'),
database = require('./database.js'),
debug = require('debug')('box:settings'),
docker = require('./docker.js'),
paths = require('./paths.js'),
safe = require('safetydance');
const SETTINGS_FIELDS = [ 'name', 'value' ].join(',');
@@ -113,12 +110,6 @@ const gDefaults = (function () {
let gCache = {};
function notifyChange(key, value) {
assert.strictEqual(typeof key, 'string');
// value is a variant
cron.handleSettingsChanged(key, value);
}
async function get(key) {
assert.strictEqual(typeof key, 'string');
@@ -184,8 +175,6 @@ async function setRegistryConfig(registryConfig) {
await docker.testRegistryConfig(registryConfig);
await set(exports.REGISTRY_CONFIG_KEY, JSON.stringify(registryConfig));
notifyChange(exports.REGISTRY_CONFIG_KEY, registryConfig);
}
async function list() {
@@ -197,11 +186,6 @@ async function list() {
// convert booleans
result[exports.DEMO_KEY] = !!result[exports.DEMO_KEY];
// convert JSON objects
[exports.BACKUP_POLICY_KEY, exports.BACKUP_CONFIG_KEY, exports.REGISTRY_CONFIG_KEY ].forEach(function (key) {
result[key] = typeof result[key] === 'object' ? result[key] : safe.JSON.parse(result[key]);
});
return result;
}
@@ -251,7 +235,6 @@ async function setApiServerOrigin(origin) {
await set(exports.API_SERVER_ORIGIN_KEY, origin);
gCache.apiServerOrigin = origin;
notifyChange(exports.API_SERVER_ORIGIN_KEY, origin);
}
function apiServerOrigin() { return gCache.apiServerOrigin; }