diff --git a/src/lib/__snapshots__/create-config.test.ts.snap b/src/lib/__snapshots__/create-config.test.ts.snap index 171c49c85f..61fba90499 100644 --- a/src/lib/__snapshots__/create-config.test.ts.snap +++ b/src/lib/__snapshots__/create-config.test.ts.snap @@ -144,7 +144,6 @@ exports[`should create default config 1`] = ` "newEventSearch": false, "originMiddleware": false, "outdatedSdksBanner": false, - "parseProjectFromSession": false, "personalAccessTokensKillSwitch": false, "projectOverviewRefactorFeedback": false, "queryMissingTokens": false, diff --git a/src/lib/db/client-applications-store.ts b/src/lib/db/client-applications-store.ts index 54b1a96189..553e570700 100644 --- a/src/lib/db/client-applications-store.ts +++ b/src/lib/db/client-applications-store.ts @@ -436,28 +436,20 @@ export default class ClientApplicationsStore } private remapUsageRow = (input) => { - if (this.flagResolver.isEnabled('parseProjectFromSession')) { - if (!input.projects || input.projects.length === 0) { - return [ - { - app_name: input.appName, - project: '*', - environment: input.environment || '*', - }, - ]; - } else { - return input.projects.map((project) => ({ + if (!input.projects || input.projects.length === 0) { + return [ + { app_name: input.appName, - project: project, + project: '*', environment: input.environment || '*', - })); - } + }, + ]; } else { - return { + return input.projects.map((project) => ({ app_name: input.appName, - project: input.project || '*', + project: project, environment: input.environment || '*', - }; + })); } }; } diff --git a/src/lib/features/metrics/instance/register.ts b/src/lib/features/metrics/instance/register.ts index d3150acc31..59af6f5872 100644 --- a/src/lib/features/metrics/instance/register.ts +++ b/src/lib/features/metrics/instance/register.ts @@ -86,27 +86,13 @@ export default class RegisterController extends Controller { return ['default']; } - private extractProjectFromRequest( - req: IAuthRequest, - ) { - const token = req.get('Authorisation') || req.headers.authorization; - if (token) { - return token.split(':')[0]; - } - return 'default'; - } - async registerClientApplication( req: IAuthRequest, res: Response, ): Promise { const { body: data, ip: clientIp, user } = req; data.environment = this.resolveEnvironment(user, data); - if (this.flagResolver.isEnabled('parseProjectFromSession')) { - data.projects = this.resolveProject(user); - } else { - data.project = this.extractProjectFromRequest(req); - } + data.projects = this.resolveProject(user); await this.clientInstanceService.registerClient(data, clientIp); res.header('X-Unleash-Version', version).status(202).end(); diff --git a/src/lib/types/experimental.ts b/src/lib/types/experimental.ts index 001d9249ce..6dea88c0ba 100644 --- a/src/lib/types/experimental.ts +++ b/src/lib/types/experimental.ts @@ -52,7 +52,6 @@ export type IFlagKey = | 'displayEdgeBanner' | 'disableShowContextFieldSelectionValues' | 'projectOverviewRefactorFeedback' - | 'parseProjectFromSession' | 'manyStrategiesPagination' | 'enableLegacyVariants' | 'navigationSidebar' @@ -264,10 +263,6 @@ const flags: IFlags = { process.env.UNLEASH_EXPERIMENTAL_PROJECT_OVERVIEW_REFACTOR_FEEDBACK, false, ), - parseProjectFromSession: parseEnvVarBoolean( - process.env.UNLEASH_EXPERIMENTAL_PARSE_PROJECT_FROM_SESSION, - false, - ), manyStrategiesPagination: parseEnvVarBoolean( process.env.UNLEASH_EXPERIMENTAL_MANY_STRATEGIES_PAGINATION, false, diff --git a/src/server-dev.ts b/src/server-dev.ts index 3dccefc469..18419c8f48 100644 --- a/src/server-dev.ts +++ b/src/server-dev.ts @@ -48,7 +48,6 @@ process.nextTick(async () => { outdatedSdksBanner: true, disableShowContextFieldSelectionValues: false, projectOverviewRefactorFeedback: true, - parseProjectFromSession: true, manyStrategiesPagination: true, enableLegacyVariants: false, commandBarUI: true, diff --git a/src/test/e2e/api/admin/metrics.e2e.test.ts b/src/test/e2e/api/admin/metrics.e2e.test.ts index cb6722a885..5ea5e61326 100644 --- a/src/test/e2e/api/admin/metrics.e2e.test.ts +++ b/src/test/e2e/api/admin/metrics.e2e.test.ts @@ -12,9 +12,7 @@ let db: ITestDb; beforeAll(async () => { db = await dbInit('metrics_serial', getLogger, { experimental: { - flags: { - parseProjectFromSession: true, - }, + flags: {}, }, }); app = await setupAppWithCustomConfig( @@ -23,7 +21,6 @@ beforeAll(async () => { experimental: { flags: { strictSchemaValidation: true, - parseProjectFromSession: true, }, }, },