A documentation generator for .env files.
envardoc <writer> <path-to-env-file>
docs
- Prints the documentation in markdown formatexample
- Prints a.env.example
file with all variables and commentsenvar
- Prints TypeScript code to use with thejsr:@wuespace/envar
package.
deno run --allow-read jsr:@wuespace/envardoc docs .env.example > env.md
docker run -it -v .:/data ghcr.io/wuespace/envardoc:latest docs .env.example > env.md
Sections are defined by a comment line starting with #
, followed by the
section name, an empty (commented out) line, and any consecutive commentted out
lines and variables.
Sections are separated by an empty line.
# A section
#
# This is a comment
# This is another comment
VAR1=value
# This is a comment
VAR2=value
# VAR2=another-value-as-example
#
# Another variable description, still in the same section
VAR3=value
# Another section
#
# This is a comment
# ...
# Yet another section
#
# ...
Variables with no section are placed in a section called Other.
Variables are defined by 0..n comment lines describing the variable, followed by the variable name and (optionally) value, where
- for optional variables, the variable is commented out, and
- for required variables, the variable is not commented out.
Further example values can be provided in commented out name-value pairs below the initial variable definition.
# This is a required variable with no default value.
# It includes two example values.
REQUIRED_VAR=
# REQUIRED_VAR=example-value
# REQUIRED_VAR=another-example-value
#
# This is an optional variable with a default value and
# an additional example value.
# OPTIONAL_VAR=default-value
# OPTIONAL_VAR=another-example-value
#
# This is an optional variable with no default value.
# It includes two example values.
# OPTIONAL_VAR2=
# OPTIONAL_VAR2=example-value
# OPTIONAL_VAR2=another-example-value