Live data from Hacker News

Show HN: Dotenv, if it is a Unix utility

github.com

31–40 of 108 posts

Re: Show HN: Dotenv, if it is a Unix utility

#31

export $(cat .env | xargs) Agree with the premise but this can be achieved with actual Unix concepts no need for anything else. The language runtime dotenv projects are banned in my engineering org.

I tend to agree, and we do this a lot actually. But it gets a little more complicated if you have several .env files.

Would love to hear more about why dotenv is banned at your org though.

Re: Show HN: Dotenv, if it is a Unix utility

#32

export $(cat .env | xargs) Agree with the premise but this can be achieved with actual Unix concepts no need for anything else. The language runtime dotenv projects are banned in my engineering org.

I tend to agree, and we do this a lot actually. But it gets a little more complicated if you have several .env files. Would love to hear more about why dotenv is banned at your org though.

Because I banned it haha. There should not be more than one .env file. Our projects have a .env.example that has any overrides a dev might want to override but this list is kept intentionally very short. Meanwhile .env is noted in gitignore. I absolutely hate seeing an entire application configured with environment variables. Some? Sure, where it makes sense. Most? No, those should be in version control, secrets aside.

I believe in convention over configuration. Most of our apps have hard-coded config, with a concise/short and finite number of things that can be overridden (like 3-4 parameters, tops). Secrets get injected.

I do subscribe to the idea of the 12 factor app, but there is a line that needs to be drawn between env config which is more dynamic and more persistent config that should be baked in to the release.

Re: Show HN: Dotenv, if it is a Unix utility

#34
post #27
post #22

This idea seems to be cloned everywhere now, so something is causing the popularity

Kubernetes / containderd / docker apps are much more convenient to configure through ENV vars, as they easily pass through the sandbox layer (whatever that may be) files are not so easy to make work. Because that's how prod works devs want to be able to recreate prod to run locally, hence the cambrian explosion of tools like this.

[deleted]

Re: Show HN: Dotenv, if it is a Unix utility

#35
post #7

Earlier quoted context omitted.

I've used direnv, but I think a nice property of OP's dotenv is that it's explicit: if I want to pass env vars, I run my program under it. If I don't, then I don't. There's no "hidden behavior" for me to forget about and then get surprised by.

As far as I'm aware of, Direnv's behavior is not hidden at all. Whenever you cd into the directory, you get a message listing all the new en var activated. And when you change the .envrc, you get another message saying that direnv has been deactivated. I never had happen to me "oh shoot !! I forgot this env var was activated because I'm in this dir".

I don't think "hidden" and "explicit" are true antonyms.

From your description, direnv is implicit and noisy, whereas dotenv seems to be (unless you embed it in a script) explicit and quiet.

Re: Show HN: Dotenv, if it is a Unix utility

#36

export $(cat .env | xargs) Agree with the premise but this can be achieved with actual Unix concepts no need for anything else. The language runtime dotenv projects are banned in my engineering org.

Your example has the downside of making the environment variables sticky, however, so it's not achieving the same thing.

Re: Show HN: Dotenv, if it is a Unix utility

#38

export $(cat .env | xargs) Agree with the premise but this can be achieved with actual Unix concepts no need for anything else. The language runtime dotenv projects are banned in my engineering org.

Your example has the downside of making the environment variables sticky, however, so it's not achieving the same thing.

That is kinda the purpose of an environment.

Re: Show HN: Dotenv, if it is a Unix utility

#40

Earlier quoted context omitted.

Your example has the downside of making the environment variables sticky, however, so it's not achieving the same thing.

That is kinda the purpose of an environment.

I jump around between multiple projects every day. Sticky environment variables carry risk.
Post reply on HN