Environment file checker/generator
This application is a checker/generator for environment files. It checks, based on a schema/base file, if your .env is up-to-date and it maintains them synchronized.
# Install the cli in devDependencies
$ npm i dotenv-checker -D
{
"scripts": {
"check-env": "dotenv-checker -s .env.schema -e .env.local",
// Execute the check-env before starting your application
"dev": "npm run check-env && next dev"
}
}
You can customize the cli options. Here you have the possible customizations:
Sets the custom file to be used as a schema/base file. This is the file which is used to sync the environment file
# Set a custom schema (file to be based on)
dotenv-checker --schema .env.base
Sets the custom file to be synchronized with the schema file.
In case this file is out-of-sync and has some keys that the schema doesn't have, it reports the named keys to you through terminal
# File to check that needs to be in sync with schema file
dotenv-checker --env .env.local
By default it auto create the environment file if it doesn't exist. If you set this to "false" you can force to be asked to create it or not in case it's needed
# File to check that needs to be in sync with schema file
dotenv-checker --skip-create-question=false
By default it auto updates the environment file if it differs from schema file. If you set this to "false" you can force to be asked to update it or not in case it's needed
# File to check that needs to be in sync with schema file
dotenv-checker --skip-update-question=false
Created with Typescript! β‘ and latin music πΊπ΅