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:
René Herrmann 2017-10-20 00:19:46 +02:00 committed by Vahid Panjganj
parent 07463964fc
commit 3ecb3d21db

View File

@ -2,12 +2,12 @@ const joi = require('joi')
const envVarsSchema = joi.object({
NODE_ENV: joi.string()
.allow(['development', 'production', 'test', 'provision'])
.valid(['development', 'production', 'test', 'provision'])
.required(),
PORT: joi.number()
.required(),
LOGGER_LEVEL: joi.string()
.allow(['error', 'warn', 'info', 'verbose', 'debug', 'silly'])
.valid(['error', 'warn', 'info', 'verbose', 'debug', 'silly'])
.default('info'),
LOGGER_ENABLED: joi.boolean()
.truthy('TRUE')