Загрузка видео...

Не удалось загрузить видео

На главную

Motherload solves the typesafe .env problem (getting autocompletion on process.env), no schemas required. 1. Import a .env file 2. That's it

46,147 просмотров • 10 дней назад •via X (Twitter)

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

Фото профиля colinhacks
colinhacks10 дней назад

Docs 👇

Фото профиля robby - rbby.dev
robby - rbby.dev10 дней назад

Wonder of this could be a potential attack vector down the line …

Фото профиля Jinjing Liang
Jinjing Liang10 дней назад

Could you show an example using your real .env file? 👀

Фото профиля Tom
Tom10 дней назад

Don’t you want a schema here though? So you can make sure they are what you expect at runtime and fail quickly if they’re not

Фото профиля Rajat
Rajat10 дней назад

I have an idea instead of importing .env file with secrets, let us import .env.schema then replace the schema format of @varlockdev with zod eg: # z.enum(["dev", "prod"]).default("dev") NODE_ENV= # z.string().optional() EXPORT=

Фото профиля Oluwafemi | penv.cloud
Oluwafemi | penv.cloud10 дней назад

Validation and agent-safe?

Фото профиля Adrian Gierakowski
Adrian Gierakowski10 дней назад

No thanks

Фото профиля François Best
François Best10 дней назад

How does it handle different .env (or any data file) contents between where you do the typechecking (dev, CI) and at runtime (prod)? Feels like it's missing a schema for true type-safety: import "./.env" with { schema: z.object({ ... }) }

Фото профиля galmenash
galmenash10 дней назад

But we need Zod to verify validity of content anyway, and it better be a func call rather than a module side effect. Am I missing something here? p.s. except that it’s really cool

Фото профиля Rohan
Rohan10 дней назад

What happens to a variable that only exists in production and is missing from the local .env?

Фото профиля Dhruv Anand
Dhruv Anand10 дней назад

Who needs this anymore?

Фото профиля All In Developer
All In Developer10 дней назад

Why .env import does not use named imports instead? import { port } from './.env'

Фото профиля Spartak
Spartak10 дней назад

importing is cool, type safety is questionable. having runtime safety is more important, like zod validation of env

Фото профиля nori
nori10 дней назад

incredible! is PORT inferred as a number?

Фото профиля Eugene
Eugene10 дней назад

not a replacement for schema validation then?

Фото профиля Suyash
Suyash10 дней назад

does it watch the file or is it a one-time import

Фото профиля Coding in Flow
Coding in Flow10 дней назад

I can't install anything with that name

Фото профиля JC Martin🧧
JC Martin🧧10 дней назад

It's a little meaningless for builds though that expect a matching env but now have no runtime validation 😢

Фото профиля Adam Genshaft
Adam Genshaft10 дней назад

That’s 🔥

Фото профиля Khushal
Khushal10 дней назад

importing the .env file directly feels illegal in a good way

Фото профиля Prathmesh
Prathmesh10 дней назад

😮

Фото профиля irazz
irazz10 дней назад

This has been a thing for a while. The scope of having typesafe is for the end-user to have the correct variables, enforcing minimum characters etc.

Фото профиля mizuki
mizuki10 дней назад

cooking again

Фото профиля Alfie Ranstead
Alfie Ranstead10 дней назад

This is insanely cool! Obviously orm-less sql is impressive but I hadn't even considered typesafe .envs Ironically had been attempting to find a nice setup with zod for this kind of thing previously.

Фото профиля All In Developer
All In Developer10 дней назад

When doing a `tsc` build, does the imported files reach the `dist` already as modules? Or we need to use node register hook for them to work at runtime?

Фото профиля BreezeOg
BreezeOg10 дней назад

just import the .env and you get autocomplete, no schema at all? nice

Фото профиля RoboKozo
RoboKozo10 дней назад

that's cool but I still would get value from zod for setting defaults, converting things like dates and numbers, and restricting values to a set of things (like log levels or aws regions)

Фото профиля Rishabh Vasudevan
Rishabh Vasudevan10 дней назад

You have made text file parsers and then give auto complete for SQL and now this. Have agents been some kind of unlock for you to be able to do this, or is it just you got to this idea only now?

Похожие видео

grwm sin contexto env
0:33

Sensitive content

grwm sin contexto env

Dennis Ngiabi

79,520 просмотров • 2 лет назад