An environment variable is a variable located in the operating system’s runtime layer. Since env var or environment variables are variables like any others, we can perform operations such as changing their values or retrieving their values.
Defining configurations in environment variables has many benefits, including:
So it can be said that writing configuration in environment variables is a best practice for many scenarios, especially in microservices, distributed applications/services, and monolithic applications with automated management.
It’s true that in terms of readability, it’s not as good as JSON or YAML.