Skip to content

Commit

Permalink
add app insights repo secret usage
Browse files Browse the repository at this point in the history
  • Loading branch information
tudorpopams committed Aug 9, 2023
1 parent fe2371b commit c1fd841
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 4 deletions.
2 changes: 2 additions & 0 deletions .github/workflows/docsite-publish-ghpages.yml
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,8 @@ jobs:

- name: Build storybook
run: yarn workspace @fluentui/public-docsite-v9 build-storybook
env:
STORYBOOK_APPINSIGHTS_INSTRUMENTATION_KEY: ${{ secrets.STORYBOOK_APPINSIGHTS_INSTRUMENTATION_KEY }}

- name: Upload Pages Artifact
uses: actions/upload-pages-artifact@v1
Expand Down
8 changes: 4 additions & 4 deletions apps/public-docsite-v9/.storybook/manager.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,12 +10,12 @@ addons.setConfig({

addons.register('application-insights', api => {
if (process.env.NODE_ENV === 'production') {
const { STORYBOOK_INSTRUMENTATION_KEY } = process.env;
const { STORYBOOK_APPINSIGHTS_INSTRUMENTATION_KEY } = process.env;

if (STORYBOOK_INSTRUMENTATION_KEY) {
if (STORYBOOK_APPINSIGHTS_INSTRUMENTATION_KEY) {
const appInsights = new ApplicationInsights({
config: {
connectionString: STORYBOOK_INSTRUMENTATION_KEY,
connectionString: STORYBOOK_APPINSIGHTS_INSTRUMENTATION_KEY,
disableCookiesUsage: true,
},
});
Expand All @@ -35,7 +35,7 @@ addons.register('application-insights', api => {
api.on(STORY_ERRORED, trackError);
api.on(STORY_MISSING, trackError);
} else {
console.warn(`[application-insights] instrumentation key not found`);
console.warn(`[application-insights] instrumentation key not found in window or env variable`);
}
}
});

0 comments on commit c1fd841

Please sign in to comment.