Setting connectionString from env in sveltekit
I've been trying to get my connection string from .env into the drizzle.config.ts file, but vite aliases are not working within the file, so i cannot access the aliased sveltekit env variables.
I really don't want to export the variable as VITE_ since that could be a security risk in the future.
4 Replies
No worries, resolved it with dotenv
That worked for me too, however I don't understand why the SvelteKit $env pariables aren't accessible in this file. Did you learn why?
Please remember that drizzle-kit is a CLI tool that is working outside SvelteKit
As such it doesn't have access to the environment variables that SvelteKit makes available to its own runtime
So you have to make it available somehow, for example with dotenv
I see. That's helpful, thanks @Angelelz.