Doesn't seem to read the correct .env.${NODE_ENV} file #86
Replies: 14 comments 5 replies
-
First of all, sorry for the delay in responding. Must have missed the notification for the issue. Let me try to debug it and come back to you |
Beta Was this translation helpful? Give feedback.
-
Tried replicating but worked successfully. Check the screenshots too |
Beta Was this translation helpful? Give feedback.
-
Also, I have added some env fixes so could you try on the latest pull |
Beta Was this translation helpful? Give feedback.
-
We tried the latest on Fedora and Windows using WSL and we had the same issue. |
Beta Was this translation helpful? Give feedback.
-
Works as expected. Can you guys maybe share the steps you did. Also on config module can you directly pass the file name on the .forRoot https://github.com/rubiin/ultimate-nest/blob/master/src/lib/config/config.module.ts |
Beta Was this translation helpful? Give feedback.
-
besides adding the env was there any change? On my case I could spin up without doing anything. Might as well try on Fedora on VM as I am on Arch @PrimeDominus |
Beta Was this translation helpful? Give feedback.
-
@rubiin just got back from a vacation. I cloned the repo again and tried again on WSL. Not sure if you updated the master branch since I last tried, but the only difference is this time I was able to run I filled out the |
Beta Was this translation helpful? Give feedback.
-
Why not just have the .env files in the project root? |
Beta Was this translation helpful? Give feedback.
-
regarding the |
Beta Was this translation helpful? Give feedback.
-
Since you are using the |
Beta Was this translation helpful? Give feedback.
-
You may notice in my last screenshot there's a vscode tab with the filename |
Beta Was this translation helpful? Give feedback.
-
Thats strange. Looks like NODE_ENV is not beimg picked. Also can I get a repro so I could see too |
Beta Was this translation helpful? Give feedback.
-
Yes, it's possible NODE_ENV is not getting picked. I could create a repo for you to reference, but I've changed nothing in the code. As you can see in the screenshot, only |
Beta Was this translation helpful? Give feedback.
-
Experiencing same issues as @PrimeDominus |
Beta Was this translation helpful? Give feedback.
-
This looks like an awesome template repo. A colleague and I spent quite a bit of time on this, but even though we created a
.env.dev
file in theenv
directory (hence./env/.env.dev
) it cannot read from this file. For example, we tried first running:NODE_ENV=dev make migrate
But, the mikro-orm-cli would ask for the dbName or clientUrl values, meaning it couldn't read them from
./env/.env.dev
,We're sure of this because we then copied
./env/.env.dev
to the project root and renamed to.env
and once again ranNODE_ENV=dev make migrate
which works and the db migration completes successfully.Furthermore, after this we removed the
.env
we created from the root project folder and ranNODE_ENV=dev npm run start:dev
and we got the below error stating the REDIS_TTL is required, which is indeed correctly set in our./env/.env.dev
but it seems this file is not being read correctly.Any advice would be appreciated 😄
Below is our
./env/.env.dev
fileBeta Was this translation helpful? Give feedback.
All reactions