Is it possible to use .env files?
See original GitHub issueI have a project with a .env
file in the root and I use import "dotenv/config";
to load the .env
to process.env
. I didn’t realize it at first but this is not working with email/index.ts
as the env values I’d expect to be defined (present in my .env
) are not set on process.env
.
Issue Analytics
- State:
- Created a year ago
- Comments:7
Top Results From Across the Web
Here's how you can actually use Node environment variables
.env files allow you to put your environment variables inside a file. You just create a new file called .env in your project...
Read more >We need to talk about the .env | Platform.sh
.env files are a surrogate environment variable for local development only, but should never be committed to Git. Understand your application!
Read more >How to Use Environment Variables in a .env file to fill out other ...
env I have several parts of the environment variable that repeat throughout the file. For example, port and ip are the same for...
Read more >Continue Using .env Files As Usual. - DEV Community
Doing so, the .env file can only be read by the owner and no one else. You can use this command in a...
Read more >.env file - IBM
env file lets you customize your individual working environment variables. Because the .env file is hidden, use the ls -a command to list...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
Just wanted to add this is a great feature to build in. I had to slightly tweak mine because I use a file with a different name:
Using
debug
helped me figure out that due to the way I havetsconfig
setup, my base path is the root of the repo, and not the location ofemails/index.ts
. After that, I was up and running with SendGrid in a matter of minutes.Great job on this, looking forward to see where it goes!
I edited
emails/index.ts
to change the contents of aconsole.log
and it’s updating without restarting (wasn’t sure if that would be the case) so I’d chalk this up to some kind of odd edge case.I’ll keep trying to reproduce as I use
mailing
but I’m fine with closing this out and can reopen if I can get it to happen again. Sorry for what amounts to noise at the moment.On a side note, really happy to find
mailing
– thank you for sharing it. I was already using MJML but had a email template compile step and previewing wasn’t as nice as I’d like (and I wasn’t usingreact-mjml
yet as it didn’t fit well in my workflow). But I’m excited to be able to use all of that and have the excellent preview capabilities ofmailing
!