mirror of
https://github.com/supabase/supabase.git
synced 2026-10-05 09:25:06 +03:00
26 lines
490 B
TypeScript
26 lines
490 B
TypeScript
import * as configcat from 'configcat-js'
|
|
|
|
let client: configcat.IConfigCatClient
|
|
|
|
function getClient() {
|
|
if (client) {
|
|
return client
|
|
}
|
|
|
|
client = configcat.getClient(
|
|
process.env.NEXT_PUBLIC_CONFIGCAT_SDK_KEY ?? '',
|
|
configcat.PollingMode.AutoPoll,
|
|
{ pollIntervalSeconds: 600 }
|
|
)
|
|
|
|
return client
|
|
}
|
|
|
|
export async function getFlags(userEmail: string = '') {
|
|
if (userEmail) {
|
|
return getClient().getAllValuesAsync(new configcat.User(userEmail))
|
|
}
|
|
|
|
return []
|
|
}
|