mirror of
https://github.com/Unleash/unleash.git
synced 2025-01-25 00:07:47 +01:00
[Gitar] Cleaning up stale flag: parseProjectFromSession with value true (#7854)
[![Gitar](https://raw.githubusercontent.com/gitarcode/.github/main/assets/gitar-banner.svg)](https://gitar.co) --- This automated PR was generated by [Gitar](https://gitar.co). View [docs](https://gitar.co/docs). Co-authored-by: Gitar <noreply@gitar.co>
This commit is contained in:
parent
bbdb5e635b
commit
caac8f3fcb
@ -144,7 +144,6 @@ exports[`should create default config 1`] = `
|
||||
"newEventSearch": false,
|
||||
"originMiddleware": false,
|
||||
"outdatedSdksBanner": false,
|
||||
"parseProjectFromSession": false,
|
||||
"personalAccessTokensKillSwitch": false,
|
||||
"projectOverviewRefactorFeedback": false,
|
||||
"queryMissingTokens": false,
|
||||
|
@ -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 || '*',
|
||||
};
|
||||
}));
|
||||
}
|
||||
};
|
||||
}
|
||||
|
@ -86,27 +86,13 @@ export default class RegisterController extends Controller {
|
||||
return ['default'];
|
||||
}
|
||||
|
||||
private extractProjectFromRequest(
|
||||
req: IAuthRequest<unknown, void, ClientApplicationSchema>,
|
||||
) {
|
||||
const token = req.get('Authorisation') || req.headers.authorization;
|
||||
if (token) {
|
||||
return token.split(':')[0];
|
||||
}
|
||||
return 'default';
|
||||
}
|
||||
|
||||
async registerClientApplication(
|
||||
req: IAuthRequest<unknown, void, ClientApplicationSchema>,
|
||||
res: Response<void>,
|
||||
): Promise<void> {
|
||||
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();
|
||||
|
@ -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,
|
||||
|
@ -48,7 +48,6 @@ process.nextTick(async () => {
|
||||
outdatedSdksBanner: true,
|
||||
disableShowContextFieldSelectionValues: false,
|
||||
projectOverviewRefactorFeedback: true,
|
||||
parseProjectFromSession: true,
|
||||
manyStrategiesPagination: true,
|
||||
enableLegacyVariants: false,
|
||||
commandBarUI: true,
|
||||
|
@ -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,
|
||||
},
|
||||
},
|
||||
},
|
||||
|
Loading…
Reference in New Issue
Block a user