2022-11-30 15:26:19 +03:00
|
|
|
import { src, dest } from "gulp";
|
2022-03-30 00:09:01 +03:00
|
|
|
// eslint-disable-next-line @typescript-eslint/no-var-requires
|
|
|
|
const replace = require("gulp-replace");
|
2020-10-06 21:17:57 +03:00
|
|
|
|
|
|
|
/** Inject the application insights key into the telemetry file */
|
|
|
|
export function injectAppInsightsKey() {
|
|
|
|
if (!process.env.APP_INSIGHTS_KEY) {
|
|
|
|
// noop
|
|
|
|
console.log(
|
|
|
|
"APP_INSIGHTS_KEY environment variable is not set. So, cannot inject it into the application.",
|
|
|
|
);
|
|
|
|
return Promise.resolve();
|
|
|
|
}
|
|
|
|
|
|
|
|
// replace the key
|
2022-11-25 17:10:40 +03:00
|
|
|
return src(["out/extension.js"])
|
2020-10-06 21:17:57 +03:00
|
|
|
.pipe(replace(/REPLACE-APP-INSIGHTS-KEY/, process.env.APP_INSIGHTS_KEY))
|
2022-11-30 15:26:19 +03:00
|
|
|
.pipe(dest("out/"));
|
2020-10-06 21:17:57 +03:00
|
|
|
}
|