From 32cf13cb0ad102b93e668f4ce2ebb38476614ad8 Mon Sep 17 00:00:00 2001 From: Anders Rognstad Date: Fri, 23 Feb 2024 10:48:20 +0100 Subject: [PATCH] test nais.js --- .nais/naiserator-dev.yaml | 3 +++ .nais/naiserator-prod.yaml | 3 +++ src/faro.ts | 5 ++++- src/nais.js | 7 +++++++ webpack.common.ts | 2 +- 5 files changed, 18 insertions(+), 2 deletions(-) create mode 100644 src/nais.js diff --git a/.nais/naiserator-dev.yaml b/.nais/naiserator-dev.yaml index a9b7187..0648cd8 100644 --- a/.nais/naiserator-dev.yaml +++ b/.nais/naiserator-dev.yaml @@ -81,5 +81,8 @@ spec: claims: extra: - "NAVident" + frontend: + generatedConfig: + mountPath: /usr/share/nginx/html/src/nais.js ingresses: - "https://finnfastlege.intern.dev.nav.no" diff --git a/.nais/naiserator-prod.yaml b/.nais/naiserator-prod.yaml index 47cbd92..3c7226f 100644 --- a/.nais/naiserator-prod.yaml +++ b/.nais/naiserator-prod.yaml @@ -81,5 +81,8 @@ spec: claims: extra: - "NAVident" + frontend: + generatedConfig: + mountPath: /usr/share/nginx/html/src/nais.js ingresses: - "https://finnfastlege.intern.nav.no" diff --git a/src/faro.ts b/src/faro.ts index 9c1ec11..e215b3d 100644 --- a/src/faro.ts +++ b/src/faro.ts @@ -1,6 +1,7 @@ import { getWebInstrumentations, initializeFaro } from "@grafana/faro-react"; import { TracingInstrumentation } from "@grafana/faro-web-tracing"; import { erLokal, erPreProd } from "@/utils/miljoUtil"; +import nais from "./nais.js"; const getUrl = () => { if (erLokal()) { @@ -12,7 +13,8 @@ const getUrl = () => { } }; -export const initFaro = () => +export const initFaro = () => { + console.log("faro nais:", nais); initializeFaro({ url: getUrl(), app: { name: "finnfastlege" }, @@ -22,3 +24,4 @@ export const initFaro = () => new TracingInstrumentation(), ], }); +}; diff --git a/src/nais.js b/src/nais.js new file mode 100644 index 0000000..d1767ed --- /dev/null +++ b/src/nais.js @@ -0,0 +1,7 @@ +export default { + telemetryCollectorURL: "http://localhost:12347/collect", + app: { + name: "finnfastlege", + version: "dev", + }, +}; diff --git a/webpack.common.ts b/webpack.common.ts index 1a51b5e..7984dd7 100644 --- a/webpack.common.ts +++ b/webpack.common.ts @@ -26,7 +26,7 @@ const commonConfig: Configuration = { { test: /\.(js|ts|tsx)$/, use: { loader: "babel-loader" }, - exclude: /node_modules/, + exclude: ["./nais.js", /node_modules/], }, { test: /\.(css|sass)$/,