Skip to content

Commit

Permalink
dev: support ACTIVATE_ALL_FEATURES_DEV (#3657)
Browse files Browse the repository at this point in the history
* dev: support ACTIVATE_ALL_FEATURES_DEV

* fix imports
  • Loading branch information
spolu authored Feb 9, 2024
1 parent a9ffd07 commit b8f1eac
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 4 deletions.
19 changes: 15 additions & 4 deletions front/lib/auth.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,14 @@ import type { PlanType, SubscriptionType } from "@dust-tt/types";
import type { DustAPICredentials } from "@dust-tt/types";
import type { Result } from "@dust-tt/types";
import type { APIErrorWithStatusCode } from "@dust-tt/types";
import { Err, isAdmin, isBuilder, isUser, Ok } from "@dust-tt/types";
import {
Err,
isAdmin,
isBuilder,
isUser,
Ok,
WHITELISTABLE_FEATURES,
} from "@dust-tt/types";
import type {
GetServerSidePropsContext,
NextApiRequest,
Expand All @@ -18,7 +25,9 @@ import type {
import { getServerSession } from "next-auth/next";
import { Op } from "sequelize";

import { isDevelopment } from "@app/lib/development";
import {
FeatureFlag,
Key,
Membership,
Plan,
Expand All @@ -33,13 +42,12 @@ import { new_id } from "@app/lib/utils";
import logger from "@app/logger/logger";
import { authOptions } from "@app/pages/api/auth/[...nextauth]";

import { FeatureFlag } from "./models/feature_flag";

const {
DUST_DEVELOPMENT_WORKSPACE_ID,
DUST_DEVELOPMENT_SYSTEM_API_KEY,
NODE_ENV,
DUST_PROD_API = "https://dust.tt",
ACTIVATE_ALL_FEATURES_DEV = false,
} = process.env;

/**
Expand Down Expand Up @@ -384,7 +392,10 @@ export class Authenticator {
allowedDomain: this._workspace.allowedDomain || null,
role: this._role,
segmentation: this._workspace.segmentation || null,
flags: this._flags,
flags:
ACTIVATE_ALL_FEATURES_DEV && isDevelopment()
? [...WHITELISTABLE_FEATURES]
: this._flags,
}
: null;
}
Expand Down
2 changes: 2 additions & 0 deletions front/lib/models/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@ import {
TrackedDocument,
} from "@app/lib/models/doc_tracker";
import { EventSchema, ExtractedEvent } from "@app/lib/models/extract";
import { FeatureFlag } from "@app/lib/models/feature_flag";
import { Plan, Subscription } from "@app/lib/models/plan";
import { User, UserMetadata } from "@app/lib/models/user";
import {
Expand Down Expand Up @@ -64,6 +65,7 @@ export {
DocumentTrackerChangeSuggestion,
EventSchema,
ExtractedEvent,
FeatureFlag,
GlobalAgentSettings,
Key,
Membership,
Expand Down

0 comments on commit b8f1eac

Please sign in to comment.