Can't set env variables in package.json scripts?
So essentially I'm trying to run some test scripts (playwright for example) and I want to assign an env var like APP_ENV=test or something like that when I do, this way I can swap the database to a local testing db
src/server/db/index.ts 1:
I've seen several instances as I've been googling of people simply adding things to scripts like:
Example: https://stackoverflow.com/a/77810676/630988
But for some reason when I try and do this it doesn't work, my log results always show undefined as well if I don't have something pre-set in .env, and when something is pre set it never changes to test.
Note: I should mention I'm using Mac OSX, and I've also tried using
cross-env
and that also didn't work.
So I'm not sure if the src/env.js
file has something to do with this, but I've tried adding stuff in there as well and had no difference in results. I'm also not entirely sure how I could use that SKIP_ENV_VALIDATION or if it would even help. https://github.com/t3-oss/t3-envStack Overflow
How to have both production and test databases in Drizzle ORM?
I'm developing an application with Drizzle ORM (pg). I would like to have two identical databases (or schemas)? One for testing/development/debugging and another for production. What is the best...
GitHub
GitHub - t3-oss/t3-env
Contribute to t3-oss/t3-env development by creating an account on GitHub.
1 Reply
src/env.js 1: