forked from zodern/mup-node
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathvalidate.js
41 lines (36 loc) · 1 KB
/
validate.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
var joi = require('joi');
var schema = joi.object().keys({
name: joi.string().min(1).required(),
path: joi.string().min(1).required(),
type: joi.string().required(),
nodeVersion: joi.string(),
servers: joi.object().required().pattern(
/[/s/S]*/,
joi.object().keys()
),
env: joi.object().pattern(
/[/s/S]*/,
[joi.string().allow(""), joi.number(), joi.bool()]
),
startScript: joi.string(),
docker: joi.object().keys({
args: joi.array().items(joi.string()),
networks: joi.array().items(joi.string()),
buildInstructions: joi.array().items(joi.string()),
imagePort: joi.number(),
imageName: joi.string(),
}),
deployCheckWaitTime: joi.number()
});
module.exports = function (config, utils) {
var details = []
details = utils.combineErrorDetails(
details,
joi.validate(config.app, schema, utils.VALIDATE_OPTIONS)
);
details = utils.combineErrorDetails(
details,
utils.serversExist(config.servers, config.app.servers)
);
return details;
}