Hacker News new | past | comments | ask | show | jobs | submit login
Dotenvx: A better dotenv – from the creator of `dotenv` (github.com/dotenvx)
19 points by yarapavan 7 days ago | hide | past | favorite | 9 comments

Significant discussions here 14 days ago: (354 points)


Sorry if the question is stupid but maybe someone can help understand it better. I’m using direnv (1). I like the tool for its simplicity. How are dotenv or dotenvx different?

(1) https://direnv.net/

I also came to promote direnv (and nix-direnv) since I have just started using them: they are a little more automatic and resemble python’s venv.

One thing dotenv does is that it lets you load environment variables in your program whether they are in your .envrc or in your environment.

A wonderful little library that will very hopefully finally be obsolete when Node env-file leaves experimental.

I hate environment variables so much. They’re the source of so much pain and suffering.

I never write code that uses envvars. Always use cmdline args or a config file.

If I were designing an OS I’d do everything in my power to not have an envvar API. It’s probably not possible, but damnit I’d try

Environment variables are especially convenient IMO for parameterizing Docker images when running containers, e.g. using Docker or Kubernetes, etc.

Also, for configuring all sort of credentials for libraries, e.g. AWS, WandB, HuggingFace, etc.

I also hate Docker and think it only exists because modern design principles have failed. Reliably launching a software program shouldn't be difficult. But instead we've chosen to rely on a big ugly fragile ball of global system/environment state. And the only way to even launch a program is with heavyweight containers.

Running a computer program shouldn't require a Docker image. Which in turn alleviates the need to use gross environment variables.

I was about to comment something like, “you’re strange”, but then I remembered how I spent the last several nights debugging server issues that basically boiled down to badly set environment variables. I added code to the startup script to explicitly throw when the env variables are not set/empty, but this papers over a problem and just makes debugging easier. It doesn’t solve it.

Id like to hear more. I've also felt this way but have fallen back on them (plus been too scared to question the conventional wisdom).

Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact