Is it possible to generate environment object asynchronously?
Reason: I would like to have available commit hash in my application. Idea is to use environment.ts
file. However to obtain current commit hash I need asynchronous call (eg. using git-rev).
I tried to inject variable from environment variables using process.env: $ VERSION=123 ng serve
declare var process: any;
export const environment = {
production: false,
version: process.env.VERSION
};
But this results in undefined version.
Take a look at this question : How to include git revision into angular-cli application?
There is also a discussion on github on this related subject, which it will be easier to add possibility to pass environment variables to environment.ts
: https://github.com/angular/angular-cli/issues/4318
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With