Skip to content

The Postgres development platform. Supabase gives you a dedicated Postgres database to build your web, mobile, and AI applications.

Add config cat custom attribute is_staff (#40865)

Joshen Limbcb39c4bc5ad
diff --git a/packages/common/configcat.ts b/packages/common/configcat.ts
index c70d83a695c..0316badb37f 100644
--- a/packages/common/configcat.ts
+++ b/packages/common/configcat.ts
@@ -66,16 +66,20 @@ async function getClient() {
export async function getFlags(userEmail: string = '', customAttributes?: Record<string, string>) {
const client = await getClient()
+ const _customAttributes = {
+ ...customAttributes,
+ is_staff: !!userEmail ? userEmail.includes('@supabase.').toString() : 'false',
+ }
if (!client) {
return []
} else if (userEmail) {
return client.getAllValuesAsync(
- new configcat.User(userEmail, undefined, undefined, customAttributes)
+ new configcat.User(userEmail, undefined, undefined, _customAttributes)
)
} else {
return client.getAllValuesAsync(
- new configcat.User('anonymous', undefined, undefined, customAttributes)
+ new configcat.User('anonymous', undefined, undefined, _customAttributes)
)
}
}