varlock
`varlock` gives your environment variables superpowers. Just add a few decorators and you're good to go. Or run `varlock init` and it will handle it all for you.
# Install as standalone CLIbrew install varlockcd my-projectvarlock init
# OR init and install as a dependency in a js projectnpx varlock init`varlock` will scan your project for `.env` and `.env.example` files and create a `.env.schema` file for you.
# This file uses env-spec - see https://github.com/varlock/env-spec for more info# @envFlag=APP_ENV# @defaultSensitive=false @defaultRequired=false# ---
# Env flag# @type=enum(development, staging, production, test)APP_ENV=development
# this will be overridden in .env.productionSOME_VAR=default-value
# @type=number(precision=0)NUMBER_ITEM=123.45
# @type=email(normalize=true)EMAIL_ITEM=HEllO@example.com #output: hello@example.com
# @type=urlURL_ITEM=https://example.com
# @type=portPORT="5678"
INFER_NUM=123INFER_BOOL=trueINFER_STR=asdf
NOT_SENSITIVE_ITEM="not-sensitive"
# @sensitiveSENSITIVE_ITEM=secret-valueHow it works
Using a combination of a CLI and Desktop app, your secrets are securely encrypted. They are never stored on disk and secured via your fingerprint.
Benefits
- Validation of environment variables
- Coercion based on types
- Encryption backed by biometrics
- Drop-in replacement for dotenv
Workflow with varlock
- Run `varlock init`
- Add any secret values
- Run `varlock encrypt`
- Use encrypted values via `varlock run`