Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

QUESTION: how you detect which environment.__NAME__.ts you should import. #2

Open
rodriggochaves opened this issue Dec 24, 2017 · 2 comments

Comments

@rodriggochaves
Copy link

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:

import { environment } from '../../../environments/environment';

But in the post you said to change environment.ts to enviroment.dev.ts. The script set-env.ts configure this creating a copy of current environment.__NAME__.ts?

Thanks in advance!

@gldraphael
Copy link

You only need to reference the environment.ts file. Angular takes care of using the right file. Here's a related post.

@Javarome
Copy link

Javarome commented Jan 25, 2019

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants