remove settings route entirely, redundant by now
This commit is contained in:
@@ -1,9 +1,8 @@
|
||||
'use strict';
|
||||
|
||||
exports = module.exports = {
|
||||
set,
|
||||
get,
|
||||
|
||||
getRegistryConfig,
|
||||
setRegistryConfig
|
||||
};
|
||||
|
||||
const assert = require('assert'),
|
||||
@@ -11,11 +10,10 @@ const assert = require('assert'),
|
||||
docker = require('../docker.js'),
|
||||
HttpError = require('connect-lastmile').HttpError,
|
||||
HttpSuccess = require('connect-lastmile').HttpSuccess,
|
||||
safe = require('safetydance'),
|
||||
settings = require('../settings.js');
|
||||
safe = require('safetydance');
|
||||
|
||||
async function getRegistryConfig(req, res, next) {
|
||||
const [error, registryConfig] = await safe(settings.getRegistryConfig());
|
||||
const [error, registryConfig] = await safe(docker.getRegistryConfig());
|
||||
if (error) return next(BoxError.toHttpError(error));
|
||||
|
||||
next(new HttpSuccess(200, docker.removePrivateFields(registryConfig)));
|
||||
@@ -32,28 +30,8 @@ async function setRegistryConfig(req, res, next) {
|
||||
if ('password' in req.body && typeof req.body.password !== 'string') return next(new HttpError(400, 'password is required'));
|
||||
}
|
||||
|
||||
const [error] = await safe(settings.setRegistryConfig(req.body));
|
||||
const [error] = await safe(docker.setRegistryConfig(req.body));
|
||||
if (error) return next(BoxError.toHttpError(error));
|
||||
|
||||
next(new HttpSuccess(200));
|
||||
}
|
||||
|
||||
function get(req, res, next) {
|
||||
assert.strictEqual(typeof req.params.setting, 'string');
|
||||
|
||||
switch (req.params.setting) {
|
||||
case settings.REGISTRY_CONFIG_KEY: return getRegistryConfig(req, res, next);
|
||||
|
||||
default: return next(new HttpError(404, 'No such setting'));
|
||||
}
|
||||
}
|
||||
|
||||
function set(req, res, next) {
|
||||
assert.strictEqual(typeof req.body, 'object');
|
||||
|
||||
switch (req.params.setting) {
|
||||
case settings.REGISTRY_CONFIG_KEY: return setRegistryConfig(req, res, next);
|
||||
|
||||
default: return next(new HttpError(404, 'No such setting'));
|
||||
}
|
||||
}
|
||||
@@ -10,6 +10,7 @@ exports = module.exports = {
|
||||
branding: require('./branding.js'),
|
||||
cloudron: require('./cloudron.js'),
|
||||
directoryServer: require('./directoryserver.js'),
|
||||
docker: require('./docker.js'),
|
||||
domains: require('./domains.js'),
|
||||
eventlog: require('./eventlog.js'),
|
||||
externalLdap: require('./externalldap.js'),
|
||||
@@ -24,7 +25,6 @@ exports = module.exports = {
|
||||
provision: require('./provision.js'),
|
||||
reverseProxy: require('./reverseproxy.js'),
|
||||
services: require('./services.js'),
|
||||
settings: require('./settings.js'),
|
||||
support: require('./support.js'),
|
||||
system: require('./system.js'),
|
||||
tasks: require('./tasks.js'),
|
||||
|
||||
Reference in New Issue
Block a user