mirror of
https://github.com/Unleash/unleash.git
synced 2025-02-04 00:18:01 +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,
|
"newEventSearch": false,
|
||||||
"originMiddleware": false,
|
"originMiddleware": false,
|
||||||
"outdatedSdksBanner": false,
|
"outdatedSdksBanner": false,
|
||||||
"parseProjectFromSession": false,
|
|
||||||
"personalAccessTokensKillSwitch": false,
|
"personalAccessTokensKillSwitch": false,
|
||||||
"projectOverviewRefactorFeedback": false,
|
"projectOverviewRefactorFeedback": false,
|
||||||
"queryMissingTokens": false,
|
"queryMissingTokens": false,
|
||||||
|
@ -436,28 +436,20 @@ export default class ClientApplicationsStore
|
|||||||
}
|
}
|
||||||
|
|
||||||
private remapUsageRow = (input) => {
|
private remapUsageRow = (input) => {
|
||||||
if (this.flagResolver.isEnabled('parseProjectFromSession')) {
|
if (!input.projects || input.projects.length === 0) {
|
||||||
if (!input.projects || input.projects.length === 0) {
|
return [
|
||||||
return [
|
{
|
||||||
{
|
|
||||||
app_name: input.appName,
|
|
||||||
project: '*',
|
|
||||||
environment: input.environment || '*',
|
|
||||||
},
|
|
||||||
];
|
|
||||||
} else {
|
|
||||||
return input.projects.map((project) => ({
|
|
||||||
app_name: input.appName,
|
app_name: input.appName,
|
||||||
project: project,
|
project: '*',
|
||||||
environment: input.environment || '*',
|
environment: input.environment || '*',
|
||||||
}));
|
},
|
||||||
}
|
];
|
||||||
} else {
|
} else {
|
||||||
return {
|
return input.projects.map((project) => ({
|
||||||
app_name: input.appName,
|
app_name: input.appName,
|
||||||
project: input.project || '*',
|
project: project,
|
||||||
environment: input.environment || '*',
|
environment: input.environment || '*',
|
||||||
};
|
}));
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
@ -86,27 +86,13 @@ export default class RegisterController extends Controller {
|
|||||||
return ['default'];
|
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(
|
async registerClientApplication(
|
||||||
req: IAuthRequest<unknown, void, ClientApplicationSchema>,
|
req: IAuthRequest<unknown, void, ClientApplicationSchema>,
|
||||||
res: Response<void>,
|
res: Response<void>,
|
||||||
): Promise<void> {
|
): Promise<void> {
|
||||||
const { body: data, ip: clientIp, user } = req;
|
const { body: data, ip: clientIp, user } = req;
|
||||||
data.environment = this.resolveEnvironment(user, data);
|
data.environment = this.resolveEnvironment(user, data);
|
||||||
if (this.flagResolver.isEnabled('parseProjectFromSession')) {
|
data.projects = this.resolveProject(user);
|
||||||
data.projects = this.resolveProject(user);
|
|
||||||
} else {
|
|
||||||
data.project = this.extractProjectFromRequest(req);
|
|
||||||
}
|
|
||||||
|
|
||||||
await this.clientInstanceService.registerClient(data, clientIp);
|
await this.clientInstanceService.registerClient(data, clientIp);
|
||||||
res.header('X-Unleash-Version', version).status(202).end();
|
res.header('X-Unleash-Version', version).status(202).end();
|
||||||
|
@ -52,7 +52,6 @@ export type IFlagKey =
|
|||||||
| 'displayEdgeBanner'
|
| 'displayEdgeBanner'
|
||||||
| 'disableShowContextFieldSelectionValues'
|
| 'disableShowContextFieldSelectionValues'
|
||||||
| 'projectOverviewRefactorFeedback'
|
| 'projectOverviewRefactorFeedback'
|
||||||
| 'parseProjectFromSession'
|
|
||||||
| 'manyStrategiesPagination'
|
| 'manyStrategiesPagination'
|
||||||
| 'enableLegacyVariants'
|
| 'enableLegacyVariants'
|
||||||
| 'navigationSidebar'
|
| 'navigationSidebar'
|
||||||
@ -264,10 +263,6 @@ const flags: IFlags = {
|
|||||||
process.env.UNLEASH_EXPERIMENTAL_PROJECT_OVERVIEW_REFACTOR_FEEDBACK,
|
process.env.UNLEASH_EXPERIMENTAL_PROJECT_OVERVIEW_REFACTOR_FEEDBACK,
|
||||||
false,
|
false,
|
||||||
),
|
),
|
||||||
parseProjectFromSession: parseEnvVarBoolean(
|
|
||||||
process.env.UNLEASH_EXPERIMENTAL_PARSE_PROJECT_FROM_SESSION,
|
|
||||||
false,
|
|
||||||
),
|
|
||||||
manyStrategiesPagination: parseEnvVarBoolean(
|
manyStrategiesPagination: parseEnvVarBoolean(
|
||||||
process.env.UNLEASH_EXPERIMENTAL_MANY_STRATEGIES_PAGINATION,
|
process.env.UNLEASH_EXPERIMENTAL_MANY_STRATEGIES_PAGINATION,
|
||||||
false,
|
false,
|
||||||
|
@ -48,7 +48,6 @@ process.nextTick(async () => {
|
|||||||
outdatedSdksBanner: true,
|
outdatedSdksBanner: true,
|
||||||
disableShowContextFieldSelectionValues: false,
|
disableShowContextFieldSelectionValues: false,
|
||||||
projectOverviewRefactorFeedback: true,
|
projectOverviewRefactorFeedback: true,
|
||||||
parseProjectFromSession: true,
|
|
||||||
manyStrategiesPagination: true,
|
manyStrategiesPagination: true,
|
||||||
enableLegacyVariants: false,
|
enableLegacyVariants: false,
|
||||||
commandBarUI: true,
|
commandBarUI: true,
|
||||||
|
@ -12,9 +12,7 @@ let db: ITestDb;
|
|||||||
beforeAll(async () => {
|
beforeAll(async () => {
|
||||||
db = await dbInit('metrics_serial', getLogger, {
|
db = await dbInit('metrics_serial', getLogger, {
|
||||||
experimental: {
|
experimental: {
|
||||||
flags: {
|
flags: {},
|
||||||
parseProjectFromSession: true,
|
|
||||||
},
|
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
app = await setupAppWithCustomConfig(
|
app = await setupAppWithCustomConfig(
|
||||||
@ -23,7 +21,6 @@ beforeAll(async () => {
|
|||||||
experimental: {
|
experimental: {
|
||||||
flags: {
|
flags: {
|
||||||
strictSchemaValidation: true,
|
strictSchemaValidation: true,
|
||||||
parseProjectFromSession: true,
|
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
|
Loading…
Reference in New Issue
Block a user