18 lines
612 B
TypeScript
18 lines
612 B
TypeScript
import * as gulp from 'gulp';
|
|
// eslint-disable-next-line @typescript-eslint/no-var-requires
|
|
const replace = require('gulp-replace');
|
|
|
|
/** 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
|
|
return gulp.src(['out/telemetry.js'])
|
|
.pipe(replace(/REPLACE-APP-INSIGHTS-KEY/, process.env.APP_INSIGHTS_KEY))
|
|
.pipe(gulp.dest('out/'));
|
|
}
|