Closed Azel-ytof closed 1 year ago
NG_APP_ENV is to be set from the command line indeed as the builder uses its value to determine what environment files it should load besides .env and .env.local. So it doesn't make sense to put it in an environment file.
NG_APP_ENV is set to NODE_ENV by default so doing
NODE_ENV=dev npm start
is equivalent to doing NG_APP_ENV=dev npm start
Note: If you set NG_APP_ENV to localhost (in command line) the builder will look also for an env file named .env.localhost
.
Does it make sense?
Hi,
Thank you for your answer. Yes it make sense I am currently making the CD of a project and wanted to put all in .env, but I will use a custom variable to set NODE_ENV when running it.
Hi,
I face a problem, similar to #45 (I create a new issue because I am not sure that it is exactly the same)
Angular CLI: 16.0.3 Node: 20.0.0 (Unsupported) Package Manager: npm 9.6.4 OS: linux x64 (WSL2)
"@ngx-env/builder": "^16.1.1"
I have a .env file in the root project (next to angular.json, tsconfig.json, ...) It is the only one existing and the content is :
But when I launch app (ng serve), the NG_APP_ENV is not set (but the other are taken)
Si I tried to set NG_APP_ENV in command line and it works.
So is it an issue that the env is not take from the dotenv file ? Or is it normal and I have to give i with command line each time ? Or maybe I misunderstand something and I have to set NODE_ENV or something else ?