Open rodriggochaves opened 6 years ago
You only need to reference the environment.ts
file. Angular takes care of using the right file. Here's a related post.
how do you detect which environment.NAME.ts you should import?
Angular CLI does it, depending on the configuration
parameter you run when building (ng build --configuration=production
for instance ; in such a case Angular CLI will use environments/environment.prod.ts
)
By default development is assumed, which implies no suffix.
how you import the environment constant in your files?
This is the work of set-env.ts
, which overwrites the relevant environments/environmentXxx.ts
file which the OS env variables inserted inside thanks to the dotenv node lib.
I just read your post on Medium. Great post!
I tried to use your solution. But a problem / question showed up: how you import the environment constant in your files? I search your repository and you use this:
But in the post you said to change
environment.ts
toenviroment.dev.ts
. The scriptset-env.ts
configure this creating a copy of currentenvironment.__NAME__.ts
?Thanks in advance!