Skip to content

insights: add code insights graph ql environment variable to JS context

Created by: coury-clark

Context

From #27838 (closed)

Context

We have to introduce an environment non-overridable feature flag to be able to switch our setting-based with gql API. At the moment we use setting cascade to store features flat but they all could be easily overridden which doesn't fit in our tech constraints of data migration.

How to create env feature flag with jsContext object.

Extend FE jsContext type https://sourcegraph.com/github.com/sourcegraph/sourcegraph/-/blob/client/web/src/jscontext.ts Extend GO struct with feature flag here https://sourcegraph.com/github.com/sourcegraph/sourcegraph/-/blob/cmd/frontend/internal/app/jscontext/jscontext.go?subtree=true After that it should be possible to use window.context. in any place within the app. Replace this line with window.context. statement https://sourcegraph.com/github.com/sourcegraph/sourcegraph/-/blob/client/web/src/enterprise/insights/InsightsRouter.tsx?L57&subtree=true

We need to update the jscontext to include the ENABLE_CODE_INSIGHTS_SETTINGS_STORAGE environment variable.