rename platform config to services config
This commit is contained in:
+11
-11
@@ -23,8 +23,8 @@ exports = module.exports = {
|
||||
setBackupConfig,
|
||||
setBackupCredentials,
|
||||
|
||||
getPlatformConfig,
|
||||
setPlatformConfig,
|
||||
getServicesConfig,
|
||||
setServicesConfig,
|
||||
|
||||
getExternalLdapConfig,
|
||||
setExternalLdapConfig,
|
||||
@@ -83,7 +83,7 @@ exports = module.exports = {
|
||||
|
||||
// json. if you add an entry here, be sure to fix getAll
|
||||
BACKUP_CONFIG_KEY: 'backup_config',
|
||||
PLATFORM_CONFIG_KEY: 'platform_config',
|
||||
SERVICES_CONFIG_KEY: 'services_config',
|
||||
EXTERNAL_LDAP_KEY: 'external_ldap_config',
|
||||
REGISTRY_CONFIG_KEY: 'registry_config',
|
||||
SYSINFO_CONFIG_KEY: 'sysinfo_config',
|
||||
@@ -154,7 +154,7 @@ let gDefaults = (function () {
|
||||
retentionPolicy: { keepWithinSecs: 2 * 24 * 60 * 60 }, // 2 days
|
||||
schedulePattern: '00 00 23 * * *' // every day at 11pm
|
||||
};
|
||||
result[exports.PLATFORM_CONFIG_KEY] = {};
|
||||
result[exports.SERVICES_CONFIG_KEY] = {};
|
||||
result[exports.EXTERNAL_LDAP_KEY] = {
|
||||
provider: 'noop',
|
||||
autoCreate: false
|
||||
@@ -434,24 +434,24 @@ function setBackupCredentials(credentials, callback) {
|
||||
});
|
||||
}
|
||||
|
||||
function getPlatformConfig(callback) {
|
||||
function getServicesConfig(callback) {
|
||||
assert.strictEqual(typeof callback, 'function');
|
||||
|
||||
settingsdb.get(exports.PLATFORM_CONFIG_KEY, function (error, value) {
|
||||
if (error && error.reason === BoxError.NOT_FOUND) return callback(null, gDefaults[exports.PLATFORM_CONFIG_KEY]);
|
||||
settingsdb.get(exports.SERVICES_CONFIG_KEY, function (error, value) {
|
||||
if (error && error.reason === BoxError.NOT_FOUND) return callback(null, gDefaults[exports.SERVICES_CONFIG_KEY]);
|
||||
if (error) return callback(error);
|
||||
|
||||
callback(null, JSON.parse(value));
|
||||
});
|
||||
}
|
||||
|
||||
function setPlatformConfig(platformConfig, callback) {
|
||||
function setServicesConfig(platformConfig, callback) {
|
||||
assert.strictEqual(typeof callback, 'function');
|
||||
|
||||
settingsdb.set(exports.PLATFORM_CONFIG_KEY, JSON.stringify(platformConfig), function (error) {
|
||||
settingsdb.set(exports.SERVICES_CONFIG_KEY, JSON.stringify(platformConfig), function (error) {
|
||||
if (error) return callback(error);
|
||||
|
||||
notifyChange(exports.PLATFORM_CONFIG_KEY, platformConfig);
|
||||
notifyChange(exports.SERVICES_CONFIG_KEY, platformConfig);
|
||||
|
||||
callback(null);
|
||||
});
|
||||
@@ -741,7 +741,7 @@ function getAll(callback) {
|
||||
result[exports.DEMO_KEY] = !!result[exports.DEMO_KEY];
|
||||
|
||||
// convert JSON objects
|
||||
[exports.BACKUP_CONFIG_KEY, exports.DIRECTORY_CONFIG_KEY, exports.PLATFORM_CONFIG_KEY, exports.EXTERNAL_LDAP_KEY, exports.REGISTRY_CONFIG_KEY, exports.SYSINFO_CONFIG_KEY ].forEach(function (key) {
|
||||
[exports.BACKUP_CONFIG_KEY, exports.DIRECTORY_CONFIG_KEY, exports.SERVICES_CONFIG_KEY, exports.EXTERNAL_LDAP_KEY, exports.REGISTRY_CONFIG_KEY, exports.SYSINFO_CONFIG_KEY ].forEach(function (key) {
|
||||
result[key] = typeof result[key] === 'object' ? result[key] : safe.JSON.parse(result[key]);
|
||||
});
|
||||
|
||||
|
||||
Reference in New Issue
Block a user