This example demonstrates all metadata annotations supported by the zenv generate command.
generator/
├── .env.example # Annotated environment variables
└── README.md
# Preview without writing (dry run)
./target/release/zenv generate --dry-run examples/generator
# Non-interactive mode (for CI/CD)
./target/release/zenv generate --dry-run --non-interactive examples/generator
# Actually generate the .env file
./target/release/zenv generate examples/generator
# Force overwrite existing .env
./target/release/zenv generate --force examples/generatorThe .env.example file demonstrates all available annotations:
Variable must have a value. This is the default behavior.
# @required
LOG_LEVEL=infoVariable can be skipped during generation.
# @optional
ANALYTICS_ID=Prompts the user to enter a value interactively.
# @required @prompt "PostgreSQL connection string"
DATABASE_URL=Auto-generates a cryptographically secure base64 secret.
# @required @generate 32
JWT_SECRET=
# @optional @generate 64
ENCRYPTION_KEY=Annotations can be combined:
# @optional @generate 32
WEBHOOK_SECRET=
# @required @prompt "Enter your Stripe secret key"
STRIPE_SECRET_KEY=Variables without annotations use their default value if provided:
PORT=3000
DEBUG=falseIn CI/CD environments, use --non-interactive:
- Variables with
@generatewill be auto-generated - Variables with
@promptwill be skipped (with a warning) - Variables with default values will use those defaults
- Optional variables without values will be skipped