From 3ecb3d21db10d632f97bbb7abd9ed44200966431 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ren=C3=A9=20Herrmann?= Date: Fri, 20 Oct 2017 00:19:46 +0200 Subject: [PATCH] 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. --- configWithTest.sample.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/configWithTest.sample.js b/configWithTest.sample.js index f1e1701..20815c9 100644 --- a/configWithTest.sample.js +++ b/configWithTest.sample.js @@ -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')