superjose
๐ Joined in 2017
๐ผ 44 Karma
โ๏ธ 44 posts
Load more
(Replying to PARENT post)
I learned from a friend to use Zod to check for process.env. I refined it a bit and got:
```
const EnvSchema = z.object({
NODE_ENV: z.enum(['development', 'production', 'staging']),
DATABASE_URL: z.string(),
POSTHOG_KEY: z.string(),
});export type AlertDownEnv = z.infer<typeof EnvSchema>;
export function getEnvironments(env: Record<string, string>): AlertDownEnv { return EnvSchema.parse(env); }
```
Then you can:
```
const env = getEnvironments(process.env);
```
`env` will be fully typed!
Definitely, I need to do some improvements in my frontend logic!
(Replying to PARENT post)
I'm in a process where application-level programming isn't cutting it anymore (I still have a lot to learn, but it's in the diminishing returns).
I've been looking to understand the entire stack at a deeper level (from how requests are made to how they're parsed), and this seems like the next natural step!
Thanks a bunch!
Ask HN:
"How Wiz grew so fast?"
(Replying to PARENT post)
I love to have thumbnail tabs!
(Replying to PARENT post)
(Replying to PARENT post)
(Replying to PARENT post)
https://medium.com/@tomer2138/how-canaries-stop-prompt-injec...
(Replying to PARENT post)
Here, Derek DeJonghe, provides production-ready Nginx configurations with explanations for the most common cases.
(Replying to PARENT post)