mirror of
https://github.com/hanzo-apps/dataroom.git
synced 2026-10-30 14:47:36 +00:00
@vercel/edge-config read NOTHING in production. EDGE_CONFIG is unset on this deployment, so every `get()` threw, and every call site caught it and fell back to an empty default. Several of them additionally checked `process.env. EDGE_CONFIG` and returned early, so the fallback was not even a fallback — it was the only path. What that meant, live: emails / keywords the blacklist matched nothing — abuse filtering was off trustedTeams no team was ever trusted betaFeatures no beta feature was ever on customEmail no team ever got its own sender address lib/config.ts reads these from Hanzo KV under a `config:` prefix, so a value changes with a KV write rather than a deploy — which is the reason the app reached for an edge config service to begin with. Reads never throw: a KV outage returns the caller's fallback, exactly as these call sites already assumed, so config can never take down a request path. customEmail is a Record, not a list, and now says so — it was being read through the list helper, which would have discarded it. @vercel/functions and @vercel/edge-config have no importers left and are dropped from package.json; the lockfile is regenerated and `npm ci --dry-run` is clean. @vercel/blob still has 10 importers and stays until storage moves to S3. Verified with npx tsc --noEmit: 100 errors before and after. Co-authored-by: Hanzo Dev <[email protected]>
55 lines
1.3 KiB
TypeScript
55 lines
1.3 KiB
TypeScript
import { getConfig } from "@/lib/config";
|
|
|
|
export type BetaFeatures =
|
|
| "tokens"
|
|
| "incomingWebhooks"
|
|
| "roomChangeNotifications"
|
|
| "webhooks"
|
|
| "dataroomUpload"
|
|
| "inDocumentLinks"
|
|
| "usStorage"
|
|
| "dataroomIndex"
|
|
| "slack"
|
|
| "annotations"
|
|
| "textSelection";
|
|
|
|
type BetaFeaturesRecord = Record<BetaFeatures, string[]>;
|
|
|
|
export const getFeatureFlags = async ({ teamId }: { teamId?: string }) => {
|
|
const teamFeatures: Record<BetaFeatures, boolean> = {
|
|
tokens: false,
|
|
incomingWebhooks: false,
|
|
roomChangeNotifications: false,
|
|
webhooks: false,
|
|
dataroomUpload: false,
|
|
inDocumentLinks: false,
|
|
usStorage: false,
|
|
dataroomIndex: false,
|
|
slack: false,
|
|
annotations: false,
|
|
textSelection: false,
|
|
};
|
|
|
|
if (!teamId) {
|
|
return teamFeatures;
|
|
}
|
|
|
|
let betaFeatures: BetaFeaturesRecord | undefined = undefined;
|
|
|
|
try {
|
|
betaFeatures = await getConfig<BetaFeaturesRecord | undefined>("betaFeatures", undefined);
|
|
} catch (e) {
|
|
console.error(`Error getting beta features: ${e}`);
|
|
}
|
|
|
|
if (betaFeatures) {
|
|
for (const [featureFlag, teamIds] of Object.entries(betaFeatures)) {
|
|
if (teamIds.includes(teamId)) {
|
|
teamFeatures[featureFlag as BetaFeatures] = true;
|
|
}
|
|
}
|
|
}
|
|
|
|
return teamFeatures;
|
|
};
|