Skip to content

Commit bf54f0f

Browse files
author
Rajkumar Balakrishnan
committed
Angular AppInsights Key from API
1 parent 74cdd97 commit bf54f0f

File tree

4 files changed

+9
-17
lines changed

4 files changed

+9
-17
lines changed

web/src/signalr-web/SignalRMiddleware/EventApp/src/app/configuration/configuration.service.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ export class ConfigurationService {
1515
}, error => console.error(error));
1616
}
1717

18-
get apiAddress() {
18+
get appInsightsKey() {
1919
return this.configuration.key;
2020
}
2121

web/src/signalr-web/SignalRMiddleware/EventApp/src/app/services/app-insights.service.ts

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,14 @@
11
import { Injectable } from '@angular/core';
22
import { environment } from '../../environments/environment';
33
import { AppInsights } from 'applicationinsights-js';
4-
4+
import { ConfigurationService} from '../../app/configuration/configuration.service';
55
@Injectable()
66
export class AppInsightsService {
77

8-
private config:Microsoft.ApplicationInsights.IConfig = {
9-
instrumentationKey: environment.appInsights.instrumentationKey
10-
}
11-
constructor() {
8+
private config:Microsoft.ApplicationInsights.IConfig;
9+
10+
constructor(configuration: ConfigurationService) {
11+
this.config.instrumentationKey=configuration.appInsightsKey;
1212
if(!AppInsights.config){
1313
AppInsights.downloadAndSetup(this.config);
1414
}
Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,3 @@
1-
import {ConfigurationService} from '../app/configuration/configuration.service'
2-
31
export const environment = {
4-
production: true,
5-
appInsights: {
6-
instrumentationKey: ""/*The web middleware should return the key to the Angular Environment*/
7-
}
2+
production: true
83
};

web/src/signalr-web/SignalRMiddleware/EventApp/src/environments/environment.ts

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,5 @@
44
// The list of which env maps to which file can be found in `.angular-cli.json`.
55

66
export const environment = {
7-
production: false,
8-
appInsights: {
9-
instrumentationKey: "3e0ab8f5-c675-448c-8a15-08ba5ec45317"
10-
}
11-
};
7+
production: false
8+
};

0 commit comments

Comments
 (0)