1
0
mirror of https://github.com/Unleash/unleash.git synced 2025-06-27 01:19:00 +02:00

chore: remove embedProxy flag (#9874)

Clean up old flags
This commit is contained in:
Tymoteusz Czech 2025-05-12 10:28:31 +02:00 committed by GitHub
parent 095d4d7074
commit f55ea5f387
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
8 changed files with 9 additions and 50 deletions

View File

@ -80,7 +80,6 @@ export const adminRoutes: INavigationMenuItem[] = [
{
path: '/admin/cors',
title: 'CORS origins',
flag: 'embedProxyFrontend',
menu: { adminSettings: true },
group: 'access',
},

View File

@ -1,5 +1,4 @@
import { useEffect, useState } from 'react';
import useUiConfig from 'hooks/api/getters/useUiConfig/useUiConfig';
import { useEnvironments } from 'hooks/api/getters/useEnvironments/useEnvironments';
import type { IApiTokenCreate } from 'hooks/api/actions/useApiTokensApi/useApiTokensApi';
import { TokenType } from 'interfaces/token';
@ -14,10 +13,8 @@ import type { SelectOption } from './TokenTypeSelector/TokenTypeSelector';
export type ApiTokenFormErrorType = 'tokenName' | 'projects';
export const useApiTokenForm = (project?: string) => {
const { environments } = useEnvironments();
const { uiConfig } = useUiConfig();
const initialEnvironment = environments?.find((e) => e.enabled)?.name;
const hasCreateTokenPermission = useHasRootAccess(CREATE_CLIENT_API_TOKEN);
const hasCreateProjectTokenPermission = useHasRootAccess(
CREATE_PROJECT_API_TOKEN,
project,
@ -29,24 +26,18 @@ export const useApiTokenForm = (project?: string) => {
label: `Server-side SDK (${TokenType.CLIENT})`,
title: 'Connect server-side SDK or Unleash Proxy/Edge',
enabled:
hasCreateTokenPermission || hasCreateProjectTokenPermission,
useHasRootAccess(CREATE_CLIENT_API_TOKEN) ||
hasCreateProjectTokenPermission,
},
];
const hasCreateFrontendAccess = useHasRootAccess(CREATE_FRONTEND_API_TOKEN);
const hasCreateFrontendTokenAccess = useHasRootAccess(
CREATE_PROJECT_API_TOKEN,
project,
);
if (uiConfig.flags.embedProxyFrontend) {
apiTokenTypes.splice(1, 0, {
{
key: TokenType.FRONTEND,
label: `Client-side SDK (${TokenType.FRONTEND})`,
title: 'Connect web and mobile SDK directly to Unleash',
enabled: hasCreateFrontendAccess || hasCreateFrontendTokenAccess,
});
}
enabled:
useHasRootAccess(CREATE_FRONTEND_API_TOKEN) ||
hasCreateProjectTokenPermission,
},
];
const firstAccessibleType = apiTokenTypes.find((t) => t.enabled)?.key;

View File

@ -54,7 +54,6 @@ export type UiFlags = {
T?: boolean;
UNLEASH_CLOUD?: boolean;
UG?: boolean;
embedProxyFrontend?: boolean;
maintenanceMode?: boolean;
messageBanner?: Variant;
banner?: Variant;

View File

@ -208,9 +208,6 @@ export default class FrontendAPIController extends Controller {
req: ApiUserRequest,
res: Response<FrontendApiFeaturesSchema>,
) {
if (!this.config.flagResolver.isEnabled('embedProxy')) {
throw new NotFoundError();
}
const toggles =
await this.services.frontendApiService.getFrontendApiFeatures(
req.user,
@ -231,10 +228,6 @@ export default class FrontendAPIController extends Controller {
req: ApiUserRequest<unknown, unknown, ClientMetricsSchema>,
res: Response,
) {
if (!this.config.flagResolver.isEnabled('embedProxy')) {
throw new NotFoundError();
}
if (this.config.flagResolver.isEnabled('disableMetrics')) {
res.sendStatus(204);
return;
@ -254,9 +247,6 @@ export default class FrontendAPIController extends Controller {
req: ApiUserRequest<unknown, unknown, FrontendApiClientSchema>,
res: Response<string>,
) {
if (!this.config.flagResolver.isEnabled('embedProxy')) {
throw new NotFoundError();
}
// Client registration is not yet supported by @unleash/proxy,
// but proxy clients may still expect a 200 from this endpoint.
res.sendStatus(200);

View File

@ -64,9 +64,7 @@ const apiAccessMiddleware = (
(apiUser.type === CLIENT &&
!isClientApi(req) &&
!isEdgeMetricsApi(req)) ||
(apiUser.type === FRONTEND && !isProxyApi(req)) ||
(apiUser.type === FRONTEND &&
!flagResolver.isEnabled('embedProxy'))
(apiUser.type === FRONTEND && !isProxyApi(req))
) {
res.status(403).send({
message: TOKEN_TYPE_ERROR_MESSAGE,

View File

@ -9,8 +9,6 @@ export type IFlagKey =
| 'encryptEmails'
| 'enableLicense'
| 'enableLicenseChecker'
| 'embedProxy'
| 'embedProxyFrontend'
| 'responseTimeWithAppNameKillSwitch'
| 'maintenanceMode'
| 'messageBanner'
@ -77,14 +75,6 @@ const flags: IFlags = {
anonymiseEventLog: false,
enableLicense: false,
enableLicenseChecker: false,
embedProxy: parseEnvVarBoolean(
process.env.UNLEASH_EXPERIMENTAL_EMBED_PROXY,
true,
),
embedProxyFrontend: parseEnvVarBoolean(
process.env.UNLEASH_EXPERIMENTAL_EMBED_PROXY_FRONTEND,
true,
),
responseTimeWithAppNameKillSwitch: parseEnvVarBoolean(
process.env.UNLEASH_RESPONSE_TIME_WITH_APP_NAME_KILL_SWITCH,
false,

View File

@ -36,8 +36,6 @@ process.nextTick(async () => {
experimental: {
// externalResolver: unleash,
flags: {
embedProxy: true,
embedProxyFrontend: true,
anonymiseEventLog: false,
responseTimeWithAppNameKillSwitch: false,
outdatedSdksBanner: true,

View File

@ -24,12 +24,6 @@ export function createTestConfig(config?: IUnleashOptions): IUnleashConfig {
clientFeatureCaching: {
enabled: false,
},
experimental: {
flags: {
embedProxy: true,
embedProxyFrontend: true,
},
},
publicFolder: path.join(__dirname, '../examples'),
};
const options = mergeAll<IUnleashOptions>([testConfig, config || {}]);