Refactor workspace creation (#16689)
# Introduction Created an env variable to will inject a feature flag during any new workspace init to be created through v2
This commit is contained in:
+1
@@ -16,4 +16,5 @@ export enum FeatureFlagKey {
|
||||
IS_TIMELINE_ACTIVITY_MIGRATED = 'IS_TIMELINE_ACTIVITY_MIGRATED',
|
||||
IS_GLOBAL_WORKSPACE_DATASOURCE_ENABLED = 'IS_GLOBAL_WORKSPACE_DATASOURCE_ENABLED',
|
||||
IS_READ_ON_REPLICA_ENABLED = 'IS_READ_ON_REPLICA_ENABLED',
|
||||
IS_WORKSPACE_CREATION_V2_ENABLED = 'IS_WORKSPACE_CREATION_V2_ENABLED',
|
||||
}
|
||||
|
||||
@@ -1393,6 +1393,16 @@ export class ConfigVariables {
|
||||
@IsOptional()
|
||||
IS_MAPS_AND_ADDRESS_AUTOCOMPLETE_ENABLED = false;
|
||||
|
||||
@ConfigVariablesMetadata({
|
||||
group: ConfigVariablesGroup.OTHER,
|
||||
description:
|
||||
'Enable or disable workspace creation through v2 workspaceMigration',
|
||||
type: ConfigVariableType.BOOLEAN,
|
||||
isEnvOnly: true,
|
||||
})
|
||||
@IsOptional()
|
||||
IS_WORKSPACE_CREATION_V2_ENABLED = false;
|
||||
|
||||
@ConfigVariablesMetadata({
|
||||
group: ConfigVariablesGroup.OTHER,
|
||||
isSensitive: true,
|
||||
|
||||
+11
-1
@@ -17,6 +17,7 @@ import { DnsManagerService } from 'src/engine/core-modules/dns-manager/services/
|
||||
import { CustomDomainManagerService } from 'src/engine/core-modules/domain/custom-domain-manager/services/custom-domain-manager.service';
|
||||
import { SubdomainManagerService } from 'src/engine/core-modules/domain/subdomain-manager/services/subdomain-manager.service';
|
||||
import { ExceptionHandlerService } from 'src/engine/core-modules/exception-handler/exception-handler.service';
|
||||
import { FeatureFlagKey } from 'src/engine/core-modules/feature-flag/enums/feature-flag-key.enum';
|
||||
import { FeatureFlagService } from 'src/engine/core-modules/feature-flag/services/feature-flag.service';
|
||||
import {
|
||||
FileWorkspaceFolderDeletionJob,
|
||||
@@ -242,8 +243,17 @@ export class WorkspaceService extends TypeOrmQueryService<WorkspaceEntity> {
|
||||
activationStatus: WorkspaceActivationStatus.ONGOING_CREATION,
|
||||
});
|
||||
|
||||
const isV2SyncEnabled = this.twentyConfigService.get(
|
||||
'IS_WORKSPACE_CREATION_V2_ENABLED',
|
||||
);
|
||||
|
||||
await this.featureFlagService.enableFeatureFlags(
|
||||
DEFAULT_FEATURE_FLAGS,
|
||||
[
|
||||
...DEFAULT_FEATURE_FLAGS,
|
||||
...(isV2SyncEnabled
|
||||
? [FeatureFlagKey.IS_WORKSPACE_CREATION_V2_ENABLED]
|
||||
: []),
|
||||
],
|
||||
workspace.id,
|
||||
);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user