Preferred way to deal with ENV variables when developing locally? #1947
-
I'm wondering what the preferred approach is for setting and reading environment variables is when you are developing locally with the preview server. In other frameworks I might create a So far, in lieu of that, I have:
So it does "just work" currently. But is there something more conventional or simpler than this? |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 1 reply
-
Since data loaders and page loaders are programs, you're free to load environment variables however you like. For example, My personal preference is to use direnv which integrates with your shell to set environment variables when you are in a directory, which apply to any program you run. This is nice because it works with all kinds of tools, not just ones with support for special files. |
Beta Was this translation helpful? Give feedback.
Since data loaders and page loaders are programs, you're free to load environment variables however you like. For example,
dotenv
would work fine.My personal preference is to use direnv which integrates with your shell to set environment variables when you are in a directory, which apply to any program you run. This is nice because it works with all kinds of tools, not just ones with support for special files.