We Fixed Environment Variables

We Fixed Environment Variables

Theo - t3․gg

1 год назад

61,852 Просмотров

Ссылки и html тэги не поддерживаются


Комментарии:

VillainAI
VillainAI - 23.08.2023 22:58

This took just about as long as building an entire app so…

Ответить
El Polo Diablo
El Polo Diablo - 19.08.2023 06:57

You can't call it a fix when there's no problem to begin with.

Ответить
T S
T S - 04.06.2023 21:55

"env vars are hard" well u just made them 10 times harder

Ответить
Joel Ayoub
Joel Ayoub - 03.06.2023 19:57

Lollll

Ответить
Bryan Joseph
Bryan Joseph - 03.06.2023 16:14

How’s it work with eas and react native?

Ответить
justAName
justAName - 10.05.2023 07:11

zodSchema.parse(process.env)

Ответить
Viktor Shinkevich
Viktor Shinkevich - 04.05.2023 23:06

something on javascriptian

Ответить
Tarcisio
Tarcisio - 03.05.2023 07:14

Why would I use that if I can just add 4 more lines of code instead of importing an external framework to do something easy af? Please guys, just write "You're typing process.env wrong" by Matt.

Ответить
Rob Gioeli
Rob Gioeli - 01.05.2023 07:04

Over-engineering 💯

Ответить
Jon Insley
Jon Insley - 30.04.2023 10:49

Theo, any way to use enums (strings) instead of just string?

Ответить
Jepemz
Jepemz - 30.04.2023 10:13

Love it. SvelteKit also has something similar.

Ответить
P K
P K - 30.04.2023 02:14

Wrapper around zod parse(prosess.env) 🤷‍♂️ treeshake issue = next only

Ответить
FengHuang
FengHuang - 29.04.2023 22:23

I've been using this for years 😂
Does your package support merging of .env, .env.local, .env.<environnement> and .env.<environnement>.local ?

Ответить
spotgaming
spotgaming - 29.04.2023 19:41

That red swiggly line is one of the best creative thing, give a pat yourself on the back

Ответить
Kaleab S. Melkie
Kaleab S. Melkie - 29.04.2023 18:22

Env vars are a mess in React. This just makes me really appreciate the SvelteKit way (fully typed, checked at build because they're just direct imports, server/public separation). I like how this library has validation tho.

Ответить
CommenterAccount
CommenterAccount - 29.04.2023 16:37

I frequently use env variables to tree shake in different envs at compile time. For example, any place you have process.env.NODE_ENV compiles to the actual value like "development", which tree shaking will interpret as a literal, which means "if ("development" === "production")" will tree shake out any code in this conditional. The approach in this package requires a runtime check which does not allow for tree shaking. Any thoughts on this tradeoff for this approach?

A common example is for things like integrated devtools that I don't want shipped to production

Ответить
Anush
Anush - 29.04.2023 15:01

Oh my god. Please, don't you ever get bothered by the boilerplate? Like micro-optimizing everything makes everything esoteric and that's just terrible.

Ответить
Riser
Riser - 29.04.2023 14:59

Guys is this not over engineering

Ответить
AdaLiszk
AdaLiszk - 29.04.2023 12:11

I wonder if dotenv cannot be simirarly augmented. They already have checks and a loading mechanism, and it looks like zod could be used to check either the result or the initial environment variables.

Ответить
Theodoros Antoniou
Theodoros Antoniou - 29.04.2023 11:05

This is like the Pokémon evolution of dotenv

Ответить
Vladyslav KROKHIN
Vladyslav KROKHIN - 29.04.2023 09:19

What the difference between znv and t3-env? Libraries almost identical

Ответить
David Boeger
David Boeger - 29.04.2023 08:45

I'm a systems guy, not a web dev, so maybe I'm out of touch, but were people not doing this kind of validation anyway? I've done several projects that have been configurable with environment variables, and I always did validation checks when starting the program. It seems strange to me that you would need a library to do this. I mean, maybe it could cut down on a bit of boilerplate, but don't you still have to specify the validation logic somehow? Also, I thought environment variables were conventionally optional. If you absolutely must provide them because they don't have default variables, they're usually better off as either program arguments or in a config file.

Ответить
uoc_lv
uoc_lv - 29.04.2023 08:32

Man, more crap to do basic stuff. Just stop. Less is more!

Ответить
Johannes Schaffer
Johannes Schaffer - 29.04.2023 06:42

What is the difference to just plain Zod?

Ответить
nightwish15
nightwish15 - 29.04.2023 06:36

What is hard about env variables? I don't get it

Ответить
Marshal Burton
Marshal Burton - 29.04.2023 05:53

I've been trying to figure out why my .env.local file isn't working for days and you made me realize its because of not using 'export default' in next config. thank god you were lazy!

Ответить
Rum is bad for you
Rum is bad for you - 29.04.2023 05:30

So you've reinvented config files again? Good job, it only took you 40 years 🥳

Ответить
E S
E S - 29.04.2023 04:34

bloatware...

Ответить
B. Senta
B. Senta - 29.04.2023 03:19

Thanks for giving a shout out to the engineer that actually built it

Ответить
Goran Spasojevic
Goran Spasojevic - 29.04.2023 03:06

I used to have to `export FOO=bar`
But now I can add a new library, boilerplates, types, and build steps!
Job security achieved.

Ответить
Agénor Debriat
Agénor Debriat - 29.04.2023 03:03

And of course nexxel is already there with the Nuxt adapter/integration PR! 🥵

Ответить
Leon
Leon - 29.04.2023 02:37

How is everyone OK with this... .env could be troublesome sometimes, but importing two new libs to just type check and pre-build validation???

Ответить
Jan Vincent Liwanag
Jan Vincent Liwanag - 29.04.2023 02:35

One thing i’ve been looking for is how to detect changes on the settings and have the system reactively adopt the new setting.

For ex - new timeout setting just applies it the api client. But a database url change re-establishes a db connection pool to a new server.

Ответить
Abdeljalil Elhachimi
Abdeljalil Elhachimi - 29.04.2023 02:08

I wish JS devs could stop fixing things

Ответить
P-Town Hero
P-Town Hero - 29.04.2023 01:45

Theo talk about Pulumi! I just went to a GDG meet where the spokesperson talked about it and how versatile it is with many different languages!

Ответить
Ahmed Haracic
Ahmed Haracic - 29.04.2023 01:45

Audio is out of sync for me

Ответить
Cottidae
Cottidae - 29.04.2023 01:40

I believe the issue with environment variables is generally that you don't know you need them until something breaks, then you need to find out what the values should be.
It is simply pain, and if not documented properly you'll just cry yourself to sleep at night.

Ответить
Lemmy4555
Lemmy4555 - 29.04.2023 01:36

It doesn't make sense to me, environment variables are controlled values set by the system owner, why should add complexity by validating them!

Ответить
He Hate Me
He Hate Me - 29.04.2023 00:55

Cool package. Embarrassing demo.

Ответить
Rob Malford
Rob Malford - 29.04.2023 00:34

That's super exciting Mr. Pedophile hanging around the soda machine at the arcade in 1985.

Ответить
Joshua Borseth
Joshua Borseth - 29.04.2023 00:01

This is a really awesome solution, my company uses infisical which is another really cool env variable solution. Would recommend!

Ответить
Souvlaki42
Souvlaki42 - 28.04.2023 23:45

This package seems promising enough. I had similar issues with env files. I just used the cleanEnv function from the envalid package to fix them.

Ответить
DGCP3
DGCP3 - 28.04.2023 23:33

i use env-var but i will try this

Ответить
Atheer Musa
Atheer Musa - 28.04.2023 23:26

What's the extension at the bottom of the terminal?

Ответить
Vasanth Mohan
Vasanth Mohan - 28.04.2023 23:18

Or just use a toml file ??

Ответить
Eric M
Eric M - 28.04.2023 23:16

They suck ass in NextJs for sure, but work great in SvelteKit.

Ответить