5 Replies
like if in prod use "these values" and if in dev use "these values"
https://discord.com/channels/719702312431386674/1340673529540247632
im using tanstack start, did the following:
then in my
app.config.ts
import "./env.ts";
and it errors when running pnpm dev
adding dotenv
package and doing import "dotenv/config";
in my env.ts made it work
would this be the correct approach when handling dev vs prod?
shouldn't you have completely separate .env files lol
like just make SUPABASE_URL=xxxx in your local .env file and then in your deployment on vercel or your own server or whatever, you configure the env there
so i should only store local and use prod in my deployment?
The only time you should be checking the NODE_ENV is if you're doing some dev or staging specific actions/bypasses (i.e. I bypass webhook verification locally to speed up dev testing, when in a testing env don't do this, etc.). For separating different
.env
files, most of the hosting platforms like Netlify/Vercel have env vars you can adjust and you can choose between prod, staging/preview, and local dev. The exception is if you're doing a lot of infra orchestration and hosting yourself, but that's a different conversation.you don't need prod keys in your dev environment, and vice versa. you should not have two different ENV keys for this.