What Are the Key Changes in the Dotenv-Linter V3.0.0 Release?
This article outlines the dotenv-linter v3.0.0 release written in Rust, which includes API improvements, colored output, support for multi-line values, etc.
Join the DZone community and get the full member experience.Join For Free
We have developed dotenv-linter — a useful tool for checking
.env files. It helps to find problems in
.env files that you might miss at first, but that later may result in applications working incorrectly. We made the tool universal so it can be connected to any project, regardless of the programming language.
Dotenv-linter is developed as an open-source project by Mikhail Grachev, Evrone’s software engineer.
What Is a
.env file or a
dotenv file is a simple text file that contains all the environment variables of a project. Storing configuration in the environment variables is one of the tenets of the Manifesto of Twelve-Factor App. The
.env file has a simple key-value format.
We already wrote about the dotenv-linter v2.2.0 release. Two and a half months have passed since that moment, and we are ready to present you with a new version of
dotenv-linter — v3.0.0. The subsections below are an overview of the key changes made in this release!
In the previous version,
dotenv-linter had several flags, which were essentially separate commands
This has been leading to a bit of confusion. These flags clashed and did not work with each other well:
In the new version, we have fixed this and moved the
--show-checks flags into separate
Comparing .env Files
Also, in the new version, we added a new
compare command, which allows you to compare keys in
Displaying Scanned Files
.envfiles, it was not always clear which ones were checked by
dotenv-linter and which ones weren't. This could be happening due to a non-standard file name, or the absence of any problems in these files. In the new version, we have added the display of scanned files:
You can disable this using the
To improve usability, we have added a colored warning display.
You can disable color output using the
Support for Multi-Line Values
Multi-line values can be stored in
.envfiles. One of the options looks like this:
But, when checking such values,
dotenv-linterused to display a warning:
We have fixed this and, now,
dotenv-linter does not display warnings for multiline values wrapped in quotes.
Support for the
Some libraries for working with
.env files, such as
exportprefix makes it possible to export environment variables from a file using the
When checking such files,
dotenv-linter always displayed warnings:
In the new version, we added support for the
export prefix and, now,
dotenv-linter does not display any warnings.
Support for Spaces
Another improvement is the support for spaces in values, wrapped in quotes:
Now, for such values,
dotenv-linter will not display warnings.
Also, we fixed an issue where
dotenv-linter did not display all warnings at once:
Last but not least, we have improved the performance of the already fast
dotenv-linter. The maximum start time has decreased from 9.3 ms to 4.3 ms (by more than 50%).
To check this, we made a benchmark using the
These are all the key changes that are included in the new v3.0.0 release. A big thanks to everyone who contributed! You can support the project by starring or sponsoring it on GitHub.
You can become a sponsor on GitHub Sponsors or OpenCollective.
Published at DZone with permission of Elizabeth Lvova. See the original article here.
Opinions expressed by DZone contributors are their own.