Skip to content

Commit

Permalink
Try ga env var
Browse files Browse the repository at this point in the history
  • Loading branch information
stephanebouget committed Mar 5, 2024
1 parent a8f7fc8 commit 37d9019
Show file tree
Hide file tree
Showing 5 changed files with 13 additions and 4 deletions.
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@
"build-visu": "cd ../visualization-component && yarn build:webcomponents",
"build": "npm run electron:serve-tsc && ng build --base-href ./",
"build:dev": "npm run build -- -c dev",
"build:prod": "npm run build -- -c production && npm run removeMocks",
"build:prod": "node set-env.js && npm run build -- -c production && npm run removeMocks",
"web:build": "npm run build -- -c web-production",
"electron": "electron",
"electron:serve-tsc": "tsc -p tsconfig.serve.json",
Expand Down
12 changes: 12 additions & 0 deletions scripts/set-env.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
const fs = require("fs");

const envFilePath = "./src/environments/environment.prod.ts";
let envFileContent = fs.readFileSync(envFilePath, "utf8");
const trackerId = process.env.TRACKER_ID;
if (!envFileContent.includes("TRACKER_ID")) {
envFileContent = envFileContent.replace(
/}\s*$/,
` TRACKER_ID: "${trackerId}",\n}`
);
}
fs.writeFileSync(envFilePath, envFileContent);
1 change: 0 additions & 1 deletion src/environments/environment.dev.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
export const APP_CONFIG = {
production: false,
environment: 'DEV',
TRACKER_ID: process.env.TRACKER_ID,
};
1 change: 0 additions & 1 deletion src/environments/environment.prod.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
export const APP_CONFIG = {
production: true,
environment: 'PROD',
TRACKER_ID: process.env.TRACKER_ID,
};
1 change: 0 additions & 1 deletion src/environments/environment.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
export const APP_CONFIG = {
production: false,
environment: 'LOCAL',
TRACKER_ID: process.env.TRACKER_ID,
};

0 comments on commit 37d9019

Please sign in to comment.