Skip to content

Commit

Permalink
fix: Fixed reference to build environment variables (microsoft#5216)
Browse files Browse the repository at this point in the history
* fix: Fixed reference to build environment variables

* lint
  • Loading branch information
tdurnford committed Dec 8, 2020
1 parent d016da8 commit 55cc987
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 13 deletions.
2 changes: 1 addition & 1 deletion Composer/packages/server/src/models/utilities/parser.ts
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ const debug = log.extend('helper-parser');

const BuildEnvPath = Path.join(__dirname, '../../env.json');

function getBuildEnvironment() {
export function getBuildEnvironment() {
if (fs.existsSync(BuildEnvPath)) {
return JSON.parse(fs.readFileSync(BuildEnvPath, 'utf-8'));
}
Expand Down
13 changes: 1 addition & 12 deletions Composer/packages/server/src/services/telemetry.ts
Original file line number Diff line number Diff line change
@@ -1,26 +1,15 @@
// Copyright (c) Microsoft Corporation.
// Licensed under the MIT License.
import fs from 'fs';

import * as AppInsights from 'applicationinsights';
import { TelemetryEventName, TelemetryEvents, TelemetryEventTypes, TelemetryEvent } from '@bfc/shared';

import { APPINSIGHTS_INSTRUMENTATIONKEY, piiProperties } from '../constants';
import { useElectronContext } from '../utility/electronContext';
import { Path } from '../utility/path';
import { getBuildEnvironment } from '../models/utilities/parser';

import { SettingsService } from './settings';

const buildEnvPath = Path.join(__dirname, '../../env.json');

function getBuildEnvironment() {
if (fs.existsSync(buildEnvPath)) {
return JSON.parse(fs.readFileSync(buildEnvPath, 'utf-8'));
}

return {};
}

const instrumentationKey = APPINSIGHTS_INSTRUMENTATIONKEY || getBuildEnvironment()?.APPINSIGHTS_INSTRUMENTATIONKEY;

let client;
Expand Down

0 comments on commit 55cc987

Please sign in to comment.