Skip to content

v0.2.0

Latest

Choose a tag to compare

@chintanshah35 chintanshah35 released this 26 Jan 05:03
· 1 commit to master since this release

envconfig-kit v0.2.0 Release Notes

New Validators

Enum Type - Restrict values to a specific set:

NODE_ENV: { 
  type: 'enum', 
  values: ['development', 'staging', 'production'] as const
}

Array Type - Parse comma-separated values (or custom separator):

ALLOWED_HOSTS: { type: 'array' }
TAGS: { type: 'array', separator: '|' }

JSON Type - Parse JSON strings into objects:

FEATURE_FLAGS: { type: 'json' }

Regex Type - Custom pattern validation:

API_VERSION: { type: 'regex', pattern: /^v\d+\.\d+$/ }

Integer Type - Whole numbers only (stricter than number):

PORT: { type: 'integer' }

Secret Masking

Hide sensitive values in error messages:

API_KEY: { type: 'string', secret: true }
// Error messages show API_KEY=**** instead of actual value

Custom Validation

Add your own validation logic:

PORT: { 
  type: 'number',
  validate: (value) => value >= 1024 && value <= 65535
}

Framework Presets

Pre-configured schemas for common patterns:

  • presets.server() - PORT, HOST, NODE_ENV
  • presets.database() - DATABASE_URL, DATABASE_HOST, etc.
  • presets.redis() - REDIS_URL, REDIS_HOST, etc.
  • presets.auth() - AUTH_JWT_SECRET, etc.
  • presets.aws() - AWS_ACCESS_KEY_ID, etc.
  • presets.smtp() - SMTP_HOST, SMTP_PORT, etc.
  • presets.cors() - CORS_ORIGINS, CORS_METHODS, etc.

All presets support custom prefixes:

...presets.database('DB_')  // DB_URL, DB_HOST, etc.

Improvements

  • Improved error messages with actionable fix suggestions
  • Better TypeScript inference for enum types
  • Enhanced test coverage

Breaking Changes

None. All new features are additive and backward compatible.

Installation

npm install envconfig-kit@0.2.0

Full Changelog: v0.1.0...v0.2.0