settings: move ipv6/ipv4 config into network

this also rename sysinfo_config to ipv4_config
This commit is contained in:
Girish Ramakrishnan
2023-08-03 06:05:29 +05:30
parent f2e56cbdd8
commit 92a103d635
14 changed files with 144 additions and 139 deletions
-40
View File
@@ -128,24 +128,6 @@ async function setBackupPolicy(req, res, next) {
next(new HttpSuccess(200, {}));
}
async function getIPv6Config(req, res, next) {
const [error, ipv6Config] = await safe(settings.getIPv6Config());
if (error) return next(BoxError.toHttpError(error));
next(new HttpSuccess(200, ipv6Config));
}
async function setIPv6Config(req, res, next) {
assert.strictEqual(typeof req.body, 'object');
if (!req.body.provider || typeof req.body.provider !== 'string') return next(new HttpError(400, 'provider is required'));
const [error] = await safe(settings.setIPv6Config(req.body));
if (error) return next(BoxError.toHttpError(error));
next(new HttpSuccess(200, {}));
}
async function getRegistryConfig(req, res, next) {
const [error, registryConfig] = await safe(settings.getRegistryConfig());
if (error) return next(BoxError.toHttpError(error));
@@ -189,24 +171,6 @@ async function setProfileConfig(req, res, next) {
next(new HttpSuccess(200, {}));
}
async function getSysinfoConfig(req, res, next) {
const [error, sysinfoConfig] = await safe(settings.getSysinfoConfig());
if (error) return next(BoxError.toHttpError(error));
next(new HttpSuccess(200, sysinfoConfig));
}
async function setSysinfoConfig(req, res, next) {
assert.strictEqual(typeof req.body, 'object');
if (!req.body.provider || typeof req.body.provider !== 'string') return next(new HttpError(400, 'provider is required'));
const [error] = await safe(settings.setSysinfoConfig(req.body));
if (error) return next(BoxError.toHttpError(error));
next(new HttpSuccess(200, {}));
}
async function getLanguage(req, res, next) {
const [error, language] = await safe(settings.getLanguage());
if (error) return next(BoxError.toHttpError(error));
@@ -230,10 +194,8 @@ function get(req, res, next) {
switch (req.params.setting) {
case settings.BACKUP_POLICY_KEY: return getBackupPolicy(req, res, next);
case settings.IPV6_CONFIG_KEY: return getIPv6Config(req, res, next);
case settings.BACKUP_CONFIG_KEY: return getBackupConfig(req, res, next);
case settings.REGISTRY_CONFIG_KEY: return getRegistryConfig(req, res, next);
case settings.SYSINFO_CONFIG_KEY: return getSysinfoConfig(req, res, next);
case settings.LANGUAGE_KEY: return getLanguage(req, res, next);
case settings.AUTOUPDATE_PATTERN_KEY: return getAutoupdatePattern(req, res, next);
@@ -250,9 +212,7 @@ function set(req, res, next) {
switch (req.params.setting) {
case settings.BACKUP_POLICY_KEY: return setBackupPolicy(req, res, next);
case settings.IPV6_CONFIG_KEY: return setIPv6Config(req, res, next);
case settings.REGISTRY_CONFIG_KEY: return setRegistryConfig(req, res, next);
case settings.SYSINFO_CONFIG_KEY: return setSysinfoConfig(req, res, next);
case settings.LANGUAGE_KEY: return setLanguage(req, res, next);
case settings.AUTOUPDATE_PATTERN_KEY: return setAutoupdatePattern(req, res, next);