feat: type-safe env via @t3-oss/env-core + zod#139
feat: type-safe env via @t3-oss/env-core + zod#139azizbecha wants to merge 4 commits intoBearStudio:mainfrom
Conversation
Replace ad-hoc process.env access with a validated env module so missing or malformed vars fail fast at startup instead of producing undefined runtime values.
|
Done, thanks for the review! |
|
Yes! The env schema rename to Separately, I think the workflows could be reorganized so each does one thing, happy to open a follow-up issue for that. |
The env schema rename in 12d0497 wasn't propagated to the GitHub Actions workflows, causing every job to fail at `pnpm install` because the `prepare` hook runs `gen:api`, which loads `src/env.ts` and rejects an undefined `EXPO_PUBLIC_BASE_URL`. Also adds a public demo URL fallback in code-quality.yml so lint and typecheck pass on forks where `vars.API_URL` isn't configured.
Derive EXPO_PUBLIC_AUTH_URL and EXPO_PUBLIC_OPENAPI_URL from EXPO_PUBLIC_BASE_URL inside `runtimeEnv` so both vars are always defined and validated as URLs. Consumers now read `env.EXPO_PUBLIC_*` directly without per-call-site fallback logic.
|
Nice catch! Fixed that in a new commit. The new code looks cleaner now. |
| EXPO_PUBLIC_AUTH_URL: z.url(), | ||
| EXPO_PUBLIC_OPENAPI_URL: z.url(), |
There was a problem hiding this comment.
These should be marked as optional() here, it's only required when we want to override the one based on baseUrl

Replaced ad-hoc process.env access with a validated env module so missing or malformed vars fail fast at startup instead of producing undefined runtime values, in addition to having typed env vars instead of ghosted process.env.*.