Is there any way to call drizzle-kit with the new node --env-file=.env argument?

Hey, since node supports env files since pretty recently, it would be nice if we could ditch dotenv. Now I only require dotenv to inject the environment variables to drizzle.config.ts to allow drizzle-kit to db push 😄
1 Reply
itsyoboieltr
itsyoboieltrOP•13mo ago
I tried
npx --node-options='--env-file=.env' drizzle-kit push:pg
npx --node-options='--env-file=.env' drizzle-kit push:pg
but it returns
node: --env-file= is not allowed in NODE_OPTIONS
node: --env-file= is not allowed in NODE_OPTIONS
because env files are loaded before the options are evaluated. I am wondering if there is anything else I could try? also tried
npx --env-file=.env drizzle-kit push:pg
npx --env-file=.env drizzle-kit push:pg
with no success I figured it out!!! This was not that self-explanatory lol
node --env-file=.env -e \"require('child_process').execSync('npx drizzle-kit push:pg', { stdio: 'inherit' })\"
node --env-file=.env -e \"require('child_process').execSync('npx drizzle-kit push:pg', { stdio: 'inherit' })\"
Want results from more Discord servers?
Add your server