Skip to content

Commit 093431e

Browse files
Merge pull request #2986 from ryoku4/docs/configuration-schema-validation-example-improvement
docs: improve configuration schema validation example
2 parents aa98a05 + 01c8b38 commit 093431e

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

content/techniques/configuration.md

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -355,7 +355,7 @@ import * as Joi from 'joi';
355355
NODE_ENV: Joi.string()
356356
.valid('development', 'production', 'test', 'provision')
357357
.default('development'),
358-
PORT: Joi.number().default(3000),
358+
PORT: Joi.number().port().default(3000),
359359
}),
360360
}),
361361
],
@@ -378,7 +378,7 @@ import * as Joi from 'joi';
378378
NODE_ENV: Joi.string()
379379
.valid('development', 'production', 'test', 'provision')
380380
.default('development'),
381-
PORT: Joi.number().default(3000),
381+
PORT: Joi.number().port().default(3000),
382382
}),
383383
validationOptions: {
384384
allowUnknown: false,
@@ -423,6 +423,8 @@ class EnvironmentVariables {
423423
NODE_ENV: Environment;
424424

425425
@IsNumber()
426+
@Min(0)
427+
@Max(65535)
426428
PORT: number;
427429
}
428430

0 commit comments

Comments
 (0)