Use valid instead of allow in configWithTest (#101)
The current validation using `allow` will allow any kind of string, not only the specified ones. `NODE_ENV=foo` is totally valid. Using `valid` instead should fix this.
This commit is contained in:
parent
07463964fc
commit
3ecb3d21db
@ -2,12 +2,12 @@ const joi = require('joi')
|
|||||||
|
|
||||||
const envVarsSchema = joi.object({
|
const envVarsSchema = joi.object({
|
||||||
NODE_ENV: joi.string()
|
NODE_ENV: joi.string()
|
||||||
.allow(['development', 'production', 'test', 'provision'])
|
.valid(['development', 'production', 'test', 'provision'])
|
||||||
.required(),
|
.required(),
|
||||||
PORT: joi.number()
|
PORT: joi.number()
|
||||||
.required(),
|
.required(),
|
||||||
LOGGER_LEVEL: joi.string()
|
LOGGER_LEVEL: joi.string()
|
||||||
.allow(['error', 'warn', 'info', 'verbose', 'debug', 'silly'])
|
.valid(['error', 'warn', 'info', 'verbose', 'debug', 'silly'])
|
||||||
.default('info'),
|
.default('info'),
|
||||||
LOGGER_ENABLED: joi.boolean()
|
LOGGER_ENABLED: joi.boolean()
|
||||||
.truthy('TRUE')
|
.truthy('TRUE')
|
||||||
|
Loading…
x
Reference in New Issue
Block a user