paint-brush
dotenv-linter v3.0.0: Identify Errors In .env Filesby@elizabethlvova
105 reads

dotenv-linter v3.0.0: Identify Errors In .env Files

by Elizabeth LvovaJanuary 29th, 2021
Read on Terminal Reader
Read this story w/o Javascript
tldt arrow

Too Long; Didn't Read

Read an article about dotenv-linter v3.0.0 release written in Rust that includes API improvements, colored output, support for multi-line values & export prefix

Company Mentioned

Mention Thumbnail
featured image - dotenv-linter v3.0.0: Identify Errors In .env Files
Elizabeth Lvova HackerNoon profile picture

We developed dotenv-linter — a useful open-source tool for checking .env files. It helps to find problems in .env files that you may miss at first but later result in incorrect work of applications. Such problems commonly include key duplication, incorrect word delimiter, keys without value, and invalid first characters — just to name a few. We made the tool universal; it can be connected to any project regardless of the programming language.

What is a .env file?

A .env file or 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 the Twelve-Factor App. The .env file has a simple key-value format, for example, FOO=BAR.

Here's an overview of the key changes made in this new release of dotenv-linter — v3.0.0!

API improvements

In the previous version, dotenv-linter had several flags, which were essentially separate commands  --fix and --show-checks:

This has been leading to a bit of confusion. In the new version, we have fixed this and moved the --fix and --show-checks flags into separate fix and list commands.

Comparing .env files 

Also, in the new version, we added a new compare command, which allows you to compare keys in .env files.

Displaying scanned files 👀

With multiple .env files, 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--quiet/-q flag.

Colored output 🌈

To improve usability, we have added a colored warning display. You can disable color output using the --no-color flag.

Support for multi-line values 💪

Multi-line values can be stored in .env files. Now, dotenv-linter does not display warnings for multiline values wrapped in quotes.

Support for the export prefix 🔥

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.

Improved validation 👌

Also, we fixed an issue where dotenv-linter did not display all warnings at once.

Performance improvements 🚀

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 hyperfine utility.

These are all the key changes that are included in the new v3.0.0 release. Thanks to everyone who contributed! You can support the project by starring or sponsoring it on GitHub.

Previously published at https://evrone.com/dotenv-linter-v300. The author of the story is the Chief Editor at Evrone.