Skip to content

Commit

Permalink
Protect serverless endpoint with workflow endpoint
Browse files Browse the repository at this point in the history
  • Loading branch information
martmull committed Dec 17, 2024
1 parent d0f7270 commit dc1527e
Showing 1 changed file with 8 additions and 9 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -35,17 +35,16 @@ export class ServerlessFunctionResolver {
) {}

async checkFeatureFlag(workspaceId: string) {
const isFunctionSettingsEnabled =
await this.featureFlagRepository.findOneBy({
workspaceId,
key: FeatureFlagKey.IsFunctionSettingsEnabled,
value: true,
});
const isWorkflowEnabled = await this.featureFlagRepository.findOneBy({
workspaceId,
key: FeatureFlagKey.IsWorkflowEnabled,
value: true,
});

if (!isFunctionSettingsEnabled) {
if (!isWorkflowEnabled) {
throw new ServerlessFunctionException(
`IS_FUNCTION_SETTINGS_ENABLED feature flag is not set to true for this workspace`,
ServerlessFunctionExceptionCode.SERVERLESS_FUNCTION_NOT_FOUND,
`IS_WORKFLOW_ENABLED feature flag is not set to true for this workspace`,
ServerlessFunctionExceptionCode.FEATURE_FLAG_INVALID,
);
}
}
Expand Down

0 comments on commit dc1527e

Please sign in to comment.