From d8bc97941a1254bb167e4cb154dde14d03c242ce Mon Sep 17 00:00:00 2001 From: Jardel Matias Date: Fri, 12 Aug 2022 22:32:01 -0300 Subject: [PATCH] add env validator --- .../envs-project/serverless/envs-validation.js | 11 +++++++++++ 1 file changed, 11 insertions(+) create mode 100644 demo05-envs/envs-project/serverless/envs-validation.js diff --git a/demo05-envs/envs-project/serverless/envs-validation.js b/demo05-envs/envs-project/serverless/envs-validation.js new file mode 100644 index 0000000..77bdf4b --- /dev/null +++ b/demo05-envs/envs-project/serverless/envs-validation.js @@ -0,0 +1,11 @@ +const envVar = require('env-var') + +const settings = { + NODE_ENV: envVar.get('NODE_ENV').required().asEnum(['LOCAL', 'DEVELOPMENT', 'HOMOLOG', 'PRODUCTION']), + BASE_URL: envVar.get('BASE_URL').required().asUrlString(), + TABLE_NAME: envVar.get('TABLE_NAME').required().asString(), + WRITE_CAPACITY: envVar.get('WRITE_CAPACITY').required().asInt(), + READ_CAPATICY: envVar.get('READ_CAPATICY').required().asInt() +} + +module.exports = settings \ No newline at end of file