logoalt Hacker News

chacham15today at 4:50 PM2 repliesview on HN

This article reads like more of an ad than anything else.

> Environment variables only deliver values

Yes, the problem .env files try to solve is having "environment variables" be injectable from a file so that different applications can have different environment variables by default.

> A string is not a schema

Yes, input validation is an application concern. The application should know what these values represent / how to parse them and error if they're invalid.

I could go on, but the article is all about trying to use a hammer as a screwdriver and complaining that the hammer doesnt work.


Replies

jt2190today at 5:02 PM

> Yes, the problem .env files try to solve is having "environment variables" be injectable from a file so that different applications can have different environment variables by default.

This seems like a misunderstanding: The `.env` file should be `source`d into the current shell (environment). The application reads values using whatever mechanism it uses to read these values from the environment. Nothing should be “injected” into the application, i.e. the application should not read `.env` directly.

(Not sure if you were just being loose with your terminology, trying to clarify.)

show 1 reply
nsxwolftoday at 7:51 PM

First couple sentences sounded like AI so I just stopped.