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 valueCustom 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_ENVpresets.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.0Full Changelog: v0.1.0...v0.2.0