ZORL
zorath-env v0.3.6: YAML Schemas, Export Command, and 5 New Developer Tools
8 min read

zorath-env v0.3.6: YAML Schemas, Export Command, and 5 New Developer Tools

zorath-env v0.3.6 adds YAML schema support, export command for Docker and Kubernetes, doctor diagnostics, fix auto-repair, scan for code analysis, and 4 new validation types.

zorath-envzenvyaml schemaenv validationdotenv

zorath-env v0.3.6 is now available. This release delivers YAML schema support, an export command with 6 output formats, and 5 new developer tools that make environment variable management faster and safer.

Whether you need to export your .env to a Kubernetes ConfigMap, scan your codebase for unused variables, or auto-fix common configuration issues, v0.3.6 has you covered.

What is zorath-env?

zorath-env (command: zenv) is a fast, open-source CLI tool that validates .env files against JSON or YAML schemas. It catches configuration errors, type mismatches, and leaked secrets before they reach production.

Written in Rust, it runs entirely locally with zero dependencies and no telemetry. Install it once and it works with any tech stack.

Release Highlights

  • YAML schema support - Write schemas in YAML with comments
  • Export command - Convert .env to Docker, Kubernetes, shell, JSON, systemd, or dotenv formats
  • 4 new validation types - port, ipv6, date, hostname
  • Doctor command - Health diagnostics with actionable suggestions
  • Fix command - Auto-repair common .env issues with backup
  • Scan command - Find env vars in your code across 9 languages
  • Cache command - Manage remote schema cache
  • Severity levels - Separate warnings from errors
  • JSON output - Machine-readable validation for CI/CD
  • Remote schema security - SHA-256 hash verification and custom CA certificates
  • 341 tests - Comprehensive coverage for reliability

YAML Schema Support

You can now write schemas in YAML instead of JSON. YAML schemas support comments, making them easier to document and maintain.

YAML Schema Example

# env.schema.yaml
# Application configuration schema

extends: base.schema.yaml  # Inheritance works with YAML too

DATABASE_URL:
  type: url
  required: true
  description: PostgreSQL connection string

PORT:
  type: port  # New type! Validates 1-65535
  required: false
  default: 3000

NODE_ENV:
  type: enum
  values:
    - development
    - staging
    - production
  default: development

DEBUG:
  type: bool
  severity: warning  # Won't fail CI, just warns

Using YAML Schemas

# Auto-detected by file extension
zenv check --schema env.schema.yaml

# Generate docs from YAML schema
zenv docs --schema env.schema.yaml

# Mix formats: YAML can extend JSON schemas
# base.schema.json -> app.schema.yaml

YAML and JSON schemas are fully interchangeable. A YAML schema can extend a JSON schema and vice versa.

Export Command

The new zenv export command converts your .env file to deployment-ready formats. Stop manually converting environment variables for different platforms.

Supported Export Formats

Format Output Use Case
shell export FOO="bar" Shell scripts, .bashrc
docker ENV FOO=bar Dockerfiles
k8s ConfigMap YAML Kubernetes deployments
json {"FOO": "bar"} API configs, tooling
systemd Environment="FOO=bar" systemd unit files
dotenv FOO=bar Standard .env format

Export Examples

# Generate Kubernetes ConfigMap
zenv export .env --format k8s > configmap.yaml

# Generate Dockerfile ENV statements
zenv export .env --format docker >> Dockerfile

# Export only schema-defined variables (filter out dev-only vars)
zenv export .env --format k8s --schema env.schema.json

# Export to shell script
zenv export .env --format shell > env.sh
source env.sh

Kubernetes ConfigMap Output

apiVersion: v1
kind: ConfigMap
metadata:
  name: app-config
data:
  DATABASE_URL: "postgres://localhost:5432/myapp"
  PORT: "3000"
  NODE_ENV: "production"

New Validation Types

v0.3.6 adds 4 new types for common environment variable patterns.

Port Type

Validates port numbers from 1 to 65535.

{
  "PORT": {
    "type": "port",
    "required": true
  },
  "METRICS_PORT": {
    "type": "port",
    "default": 9090
  }
}
# Valid
PORT=3000
PORT=8080
PORT=443

# Invalid
PORT=0        # Below minimum
PORT=70000    # Above maximum
PORT=http     # Not a number

IPv6 Type

Validates IPv6 addresses in standard notation.

{
  "BIND_ADDRESS_V6": {
    "type": "ipv6",
    "required": false
  }
}

Date Type

Validates ISO 8601 date format (YYYY-MM-DD).

{
  "RELEASE_DATE": {
    "type": "date",
    "required": true
  }
}

Hostname Type

Validates RFC 1123 hostnames.

{
  "API_HOST": {
    "type": "hostname",
    "required": true
  }
}

Doctor Command

The zenv doctor command runs health diagnostics on your environment setup. It checks for common issues and provides actionable suggestions.

zenv doctor

Doctor Output

zenv Doctor
===========

Installation
  Version: 0.3.6
  Binary: /usr/local/bin/zenv

Schema Files
  env.schema.json: found
  env.schema.yaml: not found

Environment Files
  .env: found
  .env.local: found
  .env.example: found

Validation
  .env against env.schema.json: passed

Cache
  Path: ~/.cache/zorath-env
  Entries: 2

Suggestions
  None - everything looks good!

Doctor checks:

  • Schema file exists and parses correctly
  • Environment files exist and parse correctly
  • Config file (.zenvrc) validity
  • Remote schema cache status
  • Runs validation test if both schema and env exist

Fix Command

The zenv fix command auto-repairs common .env issues. It creates a backup before making changes.

# Preview changes without applying
zenv fix --dry-run

# Sort variables alphabetically
zenv fix --sort

# Add missing required variables with defaults
zenv fix --add-missing

# Remove variables not defined in schema
zenv fix --remove-unknown

# Full cleanup
zenv fix --sort --add-missing --remove-unknown

Dry Run Output

Would make the following changes:
  + Add: LOG_LEVEL=info (default)
  + Add: CACHE_TTL=3600 (default)
  - Remove: DEPRECATED_VAR
  - Remove: OLD_API_KEY
  ~ Sort: 12 variables alphabetically

Run without --dry-run to apply changes.
Backup will be created at .env.backup

Scan Command

The zenv scan command searches your source code for environment variable usage. Find unused variables, detect undocumented ones, and keep your schema in sync with your code.

Supported Languages

  • JavaScript / TypeScript
  • Python
  • Go
  • Rust
  • Ruby
  • PHP
  • Java
  • C#
  • Kotlin

Scan Examples

# Scan current directory
zenv scan

# Show variables in schema but not found in code
zenv scan --show-unused

# Show file:line locations for each variable
zenv scan --show-paths

# JSON output for CI integration
zenv scan --format json

# Scan specific directory
zenv scan --path src/

Scan Output

Scanning 234 files...

Found in code (23 variables):
  DATABASE_URL      src/db/connection.ts:15
  PORT              src/server.ts:8
  NODE_ENV          src/config.ts:3, src/logger.ts:12
  API_KEY           src/services/api.ts:22
  ...

Unused (in schema but not in code):
  OLD_FEATURE_FLAG
  LEGACY_API_URL

Summary:
  Variables found: 23
  Variables unused: 2
  Files scanned: 234
  Languages: TypeScript, JavaScript

Cache Command

The zenv cache command manages the remote schema cache. Remote schemas are cached for 1 hour by default.

# Show cache directory path
zenv cache path

# List cached schemas with age
zenv cache list

# Clear all cached schemas
zenv cache clear

# Clear specific URL from cache
zenv cache clear https://example.com/schema.json

Cache List Output

Cached schemas:
  1. https://company.dev/env.schema.json (45m ago)
  2. https://team.internal/base.schema.yaml (2h ago, expired)

Remote Schema Security

v0.3.6 adds security features for remote schemas used in production environments.

SHA-256 Hash Verification

Verify that a remote schema has not been tampered with by checking its SHA-256 hash.

# Verify schema integrity
zenv check --schema https://company.dev/schema.json \
  --verify-hash a1b2c3d4e5f6...

# Hash prefix matching (16+ characters)
zenv check --schema https://company.dev/schema.json \
  --verify-hash a1b2c3d4e5f6g7h8

Store the trusted hash in your CI/CD secrets and verify on every build.

Custom CA Certificates

Use custom CA certificates for internal HTTPS servers.

# Use corporate CA certificate
zenv check --schema https://internal.corp/schema.json \
  --ca-cert /path/to/corporate-ca.pem

JSON Output and Severity Levels

JSON Output for CI/CD

The --format json flag outputs machine-readable validation results.

zenv check --format json
{
  "valid": false,
  "errors": [
    {"key": "PORT", "message": "expected int, got 'abc'"},
    {"key": "API_KEY", "message": "missing (required)"}
  ],
  "warnings": [
    {"key": "DEBUG", "message": "not in schema"}
  ],
  "secret_warnings": []
}

Severity Levels

Mark non-critical validations as warnings. Warnings appear in output but do not cause a non-zero exit code.

{
  "ANALYTICS_ID": {
    "type": "string",
    "required": true,
    "severity": "warning"
  }
}

Warnings are useful for:

  • Deprecated variables being phased out
  • Optional integrations (analytics, monitoring)
  • Variables that should exist but have safe fallbacks

Bug Fixes

v0.3.6 includes important bug fixes:

  • GitHub Action quoting bug - Fixed command quoting that caused CI test failures
  • --allow-missing-env flag - Now correctly skips validation when the .env file is missing (useful for schema-only validation in CI)
  • Clippy warnings - Code cleanup for Rust best practices

Full Changelog

Added in v0.3.6

  • YAML schema format support (.yaml, .yml)
  • 4 new validation types: port, ipv6, date, hostname
  • zenv export command with 6 formats
  • zenv doctor command for health diagnostics
  • zenv fix command for auto-repair
  • zenv scan command for code analysis
  • zenv cache command for cache management
  • Severity levels (warning vs error)
  • JSON output for check command
  • Remote schema security (--verify-hash, --ca-cert)
  • 341 tests total

Fixed in v0.3.6

  • GitHub Action quoting bug
  • --allow-missing-env flag behavior
  • Clippy warnings

Installation

First-Time Install

cargo install zorath-env

Upgrade

cargo install zorath-env --force

Verify Installation

zenv version
# zenv v0.3.6

Resources


Ready to validate your environment variables?

cargo install zorath-env

Share this article

Z

ZORL Team

Building developer tools that make configuration easier. Creators of zorath-env.

Previous
zorath-env v0.3.4: Watch Mode for Continuous Environment Validation
Next
Introducing .env Configuration Tools

Related Articles

Never miss config bugs again

Use zorath-env to validate your environment variables before they cause production issues.