Skip to content

Commit

Permalink
Switch App Insights from Instrumentation Key to connection String (#47)
Browse files Browse the repository at this point in the history
  • Loading branch information
marctemp authored Feb 21, 2023
1 parent 8a8aa40 commit b1f6894
Show file tree
Hide file tree
Showing 10 changed files with 7,536 additions and 11,252 deletions.
10 changes: 1 addition & 9 deletions .snyk
Original file line number Diff line number Diff line change
@@ -1,13 +1,5 @@
# Snyk (https://snyk.io) policy file, patches or ignores known vulnerabilities.
version: v1.22.0
# ignores vulnerabilities until expiry date; change duration by modifying expiry date
ignore:
SNYK-JS-HAPISTATEHOOD-2769251:
- '@hapi/hapi > @hapi/statehood':
reason: None given
expires: '2022-05-21T10:25:13.298Z'
SNYK-JS-MOMENT-2440688:
- moment:
reason: None given
expires: '2022-05-21T10:25:13.298Z'
ignore: {}
patch: {}
4 changes: 2 additions & 2 deletions app/insights.js
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
const appInsights = require('applicationinsights')

const setup = () => {
if (process.env.APPINSIGHTS_INSTRUMENTATIONKEY) {
appInsights.setup().start()
if (process.env.APPINSIGHTS_CONNECTIONSTRING) {
appInsights.setup(process.env.APPINSIGHTS_CONNECTIONSTRING).start()
console.log('App Insights Running')
const cloudRoleTag = appInsights.defaultClient.context.keys.cloudRole
const appName = process.env.APPINSIGHTS_CLOUDROLE
Expand Down
2 changes: 1 addition & 1 deletion docker-compose.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ services:
container_name: ffc-pay-web
environment:
APPINSIGHTS_CLOUDROLE: ffc-pay-web-local
APPINSIGHTS_INSTRUMENTATIONKEY: ${APPINSIGHTS_INSTRUMENTATIONKEY}
APPINSIGHTS_CONNECTIONSTRING: ${APPINSIGHTS_CONNECTIONSTRING}
PAYMENTS_SERVICE_ENDPOINT: http://ffc-pay-processing:3008
AZUREID_CLIENT_SECRET: ${AZUREID_CLIENT_SECRET}
AZUREID_CLIENT_ID: ${AZUREID_CLIENT_ID}
Expand Down
4 changes: 2 additions & 2 deletions helm/ffc-pay-web/templates/container-secret.yaml
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
{{- include "ffc-helm-library.container-secret" (list . "ffc-pay-web.container-secret") -}}
{{- define "ffc-pay-web.container-secret" -}}
stringData:
{{- if .Values.appInsights.key }}
APPINSIGHTS_INSTRUMENTATIONKEY: {{ quote .Values.appInsights.key }}
{{- if .Values.appInsights.connectionString }}
APPINSIGHTS_CONNECTIONSTRING: {{ quote .Values.appInsights.connectionString }}
{{- end }}
{{- if .Values.azureAppRegistration.enabled }}
AZUREID_CLIENT_SECRET: {{ quote .Values.azureAppRegistration.clientSecret }}
Expand Down
2 changes: 1 addition & 1 deletion helm/ffc-pay-web/values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ labels:
component: web

appInsights:
key:
connectionString:

azureAppRegistration:
enabled: true
Expand Down
Loading

0 comments on commit b1f6894

Please sign in to comment.