forked from NationalBankBelgium/stark
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(stark-build): add support for environment variables at runtime (…
…importing environment.ts file) and at compilation time (using webpack Define plugin) ISSUES CLOSED: #50
- Loading branch information
1 parent
d93d64b
commit 8ff7e35
Showing
41 changed files
with
229 additions
and
247 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
// Extra variables that live on Global that will be replaced by webpack DefinePlugin | ||
declare let ENV: "development" | "production"; | ||
declare let HMR: boolean; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
/* tslint:disable:no-import-side-effect */ | ||
import "./environment"; | ||
/* tslint:enable */ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
import { NgModuleRef } from "@angular/core"; | ||
|
||
/** | ||
* Interface to be implemented by all environments | ||
*/ | ||
export interface StarkEnvironment { | ||
/** | ||
* Whether the current environment is production | ||
*/ | ||
production: boolean; | ||
/** | ||
* Whether the current environment has Hot Module Replacement enabled | ||
*/ | ||
hmr: boolean; | ||
/** | ||
* Array of providers to be included in this environment | ||
*/ | ||
ENV_PROVIDERS: any[]; | ||
/** | ||
* Function to modify/decorate the NgModule Instance created by Angular for a given platform. | ||
* Useful to enable/disable some Angular specifics such as the debug tools. | ||
*/ | ||
decorateModuleRef(modRef: NgModuleRef<any>): NgModuleRef<any>; | ||
} | ||
|
||
// create an empty dummy environment constant (the actual values will be defined in the client app) | ||
const dummyEnv: Partial<StarkEnvironment> = {}; | ||
|
||
// export the dummy constant as "environment" to be able to mimic the way it should be imported in the client app | ||
// like this: import { environment } from "environments/environment"; | ||
export const environment: StarkEnvironment = <StarkEnvironment>dummyEnv; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.