mirror of
https://github.com/supabase/supabase.git
synced 2026-10-17 15:19:08 +03:00
* initial test. * Add base path to the rewrites. * Remove base path from the source rewrite. * Another try. * Another try. * another try. * Try another magic. * Add try/catch to the flag processing code. * Revert some of the unneeded changes. * Fix the api route for flags. * Remove vercel/toolbar for local dev. * Try using a static file for toolbar config. * Add a well known flags file in the www app. * Add headers to interpret vercel/flags as json. * Another try. * Fix the json formatting. * Add headers for the vercel/flags route in the www app. * Change to force studio to deploy.
26 lines
531 B
TypeScript
26 lines
531 B
TypeScript
import type { User } from '@supabase/supabase-js'
|
|
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(user?: User) {
|
|
if (user) {
|
|
return getClient().getAllValuesAsync(new configcat.User(user?.email ?? ''))
|
|
}
|
|
return []
|
|
}
|