Skip to content

Commit

Permalink
Fixed ld key access
Browse files Browse the repository at this point in the history
  • Loading branch information
cameron-eyds committed Dec 18, 2024
1 parent 0ea2a5c commit b0077ba
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 10 deletions.
2 changes: 1 addition & 1 deletion ppr-ui/src/plugins/init.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ export default defineNuxtPlugin(async (nuxtApp) => {
// initialize Launch Darkly
if (useRuntimeConfig().public.VUE_APP_PPR_LD_CLIENT_ID) {
console.info('Initializing Launch Darkly...')
await initLdClient()
await initLdClient(useRuntimeConfig().public.VUE_APP_PPR_LD_CLIENT_ID)
}

// Local development only
Expand Down
5 changes: 0 additions & 5 deletions ppr-ui/src/utils/config-helper.ts
Original file line number Diff line number Diff line change
Expand Up @@ -72,11 +72,6 @@ export async function fetchConfig (): Promise<any> {
sessionStorage.setItem('ACCOUNT_ID', accountId)
}

const ldClientId: string = config.VUE_APP_PPR_LD_CLIENT_ID
if (ldClientId) {
(<any>window).ldClientId = ldClientId
}

const pprStaffPartyCode: string = config.VUE_APP_PPR_STAFF_PARTY_CODE
if (pprStaffPartyCode) {
sessionStorage.setItem('PPR_STAFF_PARTY_CODE', pprStaffPartyCode)
Expand Down
7 changes: 3 additions & 4 deletions ppr-ui/src/utils/feature-flags.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import { initialize, LDClient, LDFlagSet, LDOptions, LDUser } from 'launchdarkly-js-client-sdk'
import type { LDClient, LDFlagSet, LDOptions, LDUser } from 'launchdarkly-js-client-sdk';
import { initialize } from 'launchdarkly-js-client-sdk'

/**
* Default feature flags in case LD env key is not defined (eg, local development).
Expand Down Expand Up @@ -36,9 +37,7 @@ let ldClient: LDClient = null
/**
* An async method that initializes the Launch Darkly client.
*/
export async function initLdClient (): Promise<void> {
const envKey: string = window['ldClientId'] // eslint-disable-line dot-notation

export async function initLdClient (envKey: string): Promise<void> {
if (envKey) {
const user: LDUser = {
// since we have no user data yet, use a shared key temporarily
Expand Down

0 comments on commit b0077ba

Please sign in to comment.