Add labels and tags

This commit is contained in:
Girish Ramakrishnan
2019-03-22 07:48:31 -07:00
parent 81b721be2b
commit abae4b5106
6 changed files with 109 additions and 15 deletions

View File

@@ -122,6 +122,12 @@ function installApp(req, res, next) {
if (data.backupId && typeof data.backupId !== 'string') return next(new HttpError(400, 'backupId must be string or null'));
if (data.backupFormat && typeof data.backupFormat !== 'string') return next(new HttpError(400, 'backupFormat must be string or null'));
if ('label' in data && typeof data.label !== 'string') return next(new HttpError(400, 'label must be a string'));
if ('tags' in data) {
if (!Array.isArray(data.tags)) return next(new HttpError(400, 'tags must be a string array'));
if (data.tags.some(d => typeof d !== 'string')) return next(new HttpError(400, 'tags must be in array of strings'));
}
// falsy values in cert and key unset the cert
if (data.key && typeof data.cert !== 'string') return next(new HttpError(400, 'cert must be a string'));
if (data.cert && typeof data.key !== 'string') return next(new HttpError(400, 'key must be a string'));
@@ -210,6 +216,12 @@ function configureApp(req, res, next) {
if (Object.keys(data.env).some(function (key) { return typeof data.env[key] !== 'string'; })) return next(new HttpError(400, 'env must contain values as strings'));
}
if (data.label && typeof data.label !== 'string') return next(new HttpError(400, 'label must be a non-empty string'));
if (data.tags) {
if (!Array.isArray(data.tags)) return next(new HttpError(400, 'tags must be a string array'));
if (data.tags.some(d => typeof d !== 'string')) return next(new HttpError(400, 'tags must be in array of strings'));
}
if ('dataDir' in data && typeof data.dataDir !== 'string') return next(new HttpError(400, 'dataDir must be a string'));
debug('Configuring app id:%s data:%j', req.params.id, data);