runtimeEnv property in env.mjs in create-t3-app
Hey all,
Was playing around entering some vars in the
.env
file and noticed that my app was building fine and using these new variables even though I hadn't added these vars to the env.mjs
file.
Upon further reading it looks like the server:
property in here is more of a safeguard to make sure you don't accidentally miss out env vars when building which is pretty neat 👍
I read the code comment for the runtimeEnv:
property but couldn't quite make sense of it:
I didn't add my env variable to runtimeEnv
either and things still seemed to work so just trying to figure out the importance of this and when it matters.
Thanks!4 Replies
so you dont have any variables in runtimeEnv ?
I have these ones:
But I also added
nodemailer
and specified EMAIL_SERVER
and EMAIL_FROM
in the .env
and it seems to be working fine.it wont give an error if you dont require them in example server or client
anything in them you need in runtimeEnv
ah ok... i guess i'm not really sure on how
nodemailer
is able to access the variables in the .env though? what sets it apart?