Environment variables with SvelteKit #227
Replies: 4 comments
-
This is great, Tim. Recent versions of SvelteKit have reworked the environment system. |
Beta Was this translation helpful? Give feedback.
-
Here's a reboot by Scott Spence https://scottspence.com/posts/sveltekit-environment-variables-with-the-sveltekit-env-module |
Beta Was this translation helpful? Give feedback.
-
Oh sweet - thanks for the heads up! Since it got its place on the official docs, I'll just probably point to that one at the start of the article. |
Beta Was this translation helpful? Give feedback.
-
Maybe I'm missing something, but it doesn't feel the svelte solution made the problem obsolete. I'm seeing many others have the same problem as I am having: you create a .env file and add environment variables to it. Regardless if you use static or dynamic environment variables, it seems they are still incorporated into the build process. Which is unfortunate since if you containerize your SvelteKit app, the natural behavior is to pass in the environment variables by the infrastructure. But that does not work. Passing in environment variables in docker or kubernetes are ignored and the values in the .env trump anything. Am I missing something? Seems we still need dotenv for containerized SvelteKit apps. |
Beta Was this translation helpful? Give feedback.
-
Environment variables with SvelteKit - Tim Deschryver
A simple workaround to use environment variables in SvelteKit
https://timdeschryver.dev/blog/environment-variables-with-sveltekit
Beta Was this translation helpful? Give feedback.
All reactions