0.0.8 • Published 10 months ago

env-var-check v0.0.8

Weekly downloads
-
License
ISC
Repository
github
Last release
10 months ago

Environment Variables Checker

Description

It's a simple script to check if the environment variables are set and correspond to the expected values or types.

The types and/or values of the environment variables are defined in a schema. You can use it along Zod for validations or just with a Vanilla JS Object.

Usage

First, you need to initialize the checker with the schema and the environment variables.

npx env-var-check init

Or, if you want to use it with Zod:

npx env-var-check init --zod

This will generate a /env folder containing a schema.mjs file and a env.d.ts file to use with Typescript. (You will need to include the /env folder in your tsconfig.json file)

Then, you can run the checker:

npx env-var-check check 

Or your schema is using Zod:

npx env-var-check check --zod

You might want to add it to package.json and do something like this to check the environment variables before running the app:

{
  "scripts": {
    "predev": "env-var-check check",
    "prestart": "env-var-check check",
    "dev": "...",
    "start": "..."
  }
}

Options

init

  • --zod: Initialize the schema with Zod objects instead of Vanilla JS Objects

check

  • --zod: Use Zod to validate the environment variables
  • --env: Specify the path to the environment variables file (default: .env)
  • --schema: Specify the path to the schema file (default: ./env/schema.mjs)

TODO

  • Add tests
  • Add more options
  • Implement the --schema option to specify a custom schema file path
  • Add more examples
0.0.8

10 months ago

0.0.7

10 months ago

0.0.6

10 months ago

0.0.5

10 months ago

0.0.4

10 months ago

0.0.3

10 months ago

0.0.2

10 months ago

0.0.1

10 months ago