diff --git a/CHANGES b/CHANGES index f9ecaceb9..c36baf16d 100644 --- a/CHANGES +++ b/CHANGES @@ -2200,4 +2200,5 @@ * postgresql updated to 12.5 * redis updated to 5.0.7 * proxyAuth: fix docker UA detection +* registry config: add UI to disable it diff --git a/migrations/20210209223121-settings-add-registry-config-provider.js b/migrations/20210209223121-settings-add-registry-config-provider.js new file mode 100644 index 000000000..ec53a559a --- /dev/null +++ b/migrations/20210209223121-settings-add-registry-config-provider.js @@ -0,0 +1,16 @@ +'use strict'; + +exports.up = function(db, callback) { + db.all('SELECT value FROM settings WHERE name="registry_config"', function (error, results) { + if (error || results.length === 0) return callback(error); + + var registryConfig = JSON.parse(results[0].value); + if (!registryConfig.provider) registryConfig.provider = 'other'; + + db.runSql('UPDATE settings SET value=? WHERE name="registry_config"', [ JSON.stringify(registryConfig) ], callback); + }); +}; + +exports.down = function(db, callback) { + callback(); +}; diff --git a/src/routes/settings.js b/src/routes/settings.js index 36132f410..565579247 100644 --- a/src/routes/settings.js +++ b/src/routes/settings.js @@ -194,6 +194,7 @@ function getRegistryConfig(req, res, next) { function setRegistryConfig(req, res, next) { assert.strictEqual(typeof req.body, 'object'); + if (typeof req.body.provider !== 'string') return next(new HttpError(400, 'provider is required')); if (typeof req.body.serverAddress !== 'string') return next(new HttpError(400, 'serverAddress is required')); if ('username' in req.body && typeof req.body.username !== 'string') return next(new HttpError(400, 'username is required')); if ('email' in req.body && typeof req.body.email !== 'string') return next(new HttpError(400, 'email is required'));