AJV Schema should accept useDotenv=false
See original GitHub issueIn version 2.14 configSchema.js
contains useDotenv: { const: true },
but false
is a valid value cf https://www.serverless.com/framework/docs/providers/aws/guide/serverless.yml/
Also deprecation warning LOAD_VARIABLES_FROM_ENV_FILES should not be triggered when useDotenv=false
.
Issue Analytics
- State:
- Created 3 years ago
- Reactions:2
- Comments:77 (44 by maintainers)
Top Results From Across the Web
Ajv options - Ajv JSON schema validator
Usage. This page describes properties of the options object that can be passed to Ajv constructor. For example, to report all validation errors...
Read more >API Reference | Ajv JSON schema validator
Validating function returns a boolean value (or promise for async schemas that must have $async: true property - see Asynchronous validation).
Read more >draft 2020-12 - Ajv JSON schema validator
In a simple way, JSON Schema is an object with validation keywords. The keywords and their values define what rules the data should...
Read more >Type coercion rules - Ajv JSON schema validator
In this case the validating function will try coercing the data to each type in order until some of them succeeds. Application of...
Read more >Managing schemas - Ajv JSON schema validator
Re-using validation functions Ajv validation model is optimized for server side execution, when schema compilation happens only once and validation happens ...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
We’ve decided (internally) to revert from deprecation notice, and in v3 we will keep the very same behavior as it’s in v2 (
.env
files will be loaded by the Framework only ifuseDotenv: true
setting is set).The reasoning is that we’re worried to break for users which already use
.env
files to configure the environment for lambdas, where the same root folder is shared by both service configuration and lambda logicPR that removes the deprecation in v2 will be introduced in the next days (once it’s in, we will close this issue)
I understand. I see this may bring much value for other users. I dont think it is a bad idea and Im not trying to stop it.
However, for my specific use case (and most likely others in this thread). It is useless.
.env
files.env
.env
files before creating the zip archive which will break my production environmentThat is why Im would like to see a way to say “This application does not need Serverless to care about my .env files”.
There are other suggestions from @chekalsky, @mnapoli, @jer-sen that also make sense for me. Im no expert in the internals of Serverless, I just wanted to share some input.
(This is written with much love and appreciation of course)