fix: use joi positive, integer and max validators on PORT

validate PORT with the positive, integer and max validators of Joi.

See also:
- https://joi.dev/api/#numberpositive
- https://joi.dev/api/#numberinteger
- https://joi.dev/api/#numbermax

Signed-off-by: Philip Molares <philip.molares@udo.edu>
This commit is contained in:
Philip Molares 2022-03-04 23:39:12 +01:00
parent 0a778d8a64
commit 151e12a8a7

View file

@ -29,7 +29,13 @@ const schema = Joi.object({
.default(Joi.ref('domain'))
.optional()
.label('HD_RENDERER_ORIGIN'),
port: Joi.number().default(3000).optional().label('PORT'),
port: Joi.number()
.positive()
.integer()
.default(3000)
.max(65535)
.optional()
.label('PORT'),
loglevel: Joi.string()
.valid(...Object.values(Loglevel))
.default(Loglevel.WARN)