Skip to content

Commit

Permalink
docs(build): documented environment support
Browse files Browse the repository at this point in the history
ISSUES CLOSED: NationalBankBelgium#50
  • Loading branch information
Mallikki committed Jun 13, 2018
1 parent 69ee8f4 commit 31af969
Showing 1 changed file with 43 additions and 0 deletions.
43 changes: 43 additions & 0 deletions docs/ENVIRONMENTS.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
# Environments support

## Environment.ts

In the `src/environments/model.ts` is provided the Environment interface as follows

```
...
export interface Environment {
production: boolean;
hmr: boolean;
...
```

`production`, which is a boolean, will specify is your application runs under a production environment,
while `hmr` will indicate if it runs under a Hot Module Replacement environment.

This interface will then be defined by default in `src/environments/environment.ts`:
```
...
export const environment: Environment = {
production: false,
hmr: false,
showDevModule: true,
...
```

## How to find out which environment is your application is currently using?

All you have to do is to import in your app.module.ts file the environment.ts constant
```
import { environment } from "../environments/environment";
```

This way, you will be able to programmatically determine which environment is used in your app
with simple checks, as follows:

```
environment.production
// if the output of this line is true, we are in production environment.
// Otherwise, we are in hmr environment.
```

0 comments on commit 31af969

Please sign in to comment.