mirror of
https://github.com/CompassConnections/Compass.git
synced 2026-01-02 19:08:28 -05:00
23 lines
569 B
TypeScript
23 lines
569 B
TypeScript
import { getLocalEnv, initAdmin } from 'shared/init-admin'
|
|
import { getServiceAccountCredentials, loadSecretsToEnv } from 'common/secrets'
|
|
import {
|
|
createSupabaseDirectClient,
|
|
type SupabaseDirectClient,
|
|
} from 'shared/supabase/init'
|
|
|
|
initAdmin()
|
|
|
|
export const runScript = async (
|
|
main: (services: { pg: SupabaseDirectClient }) => Promise<any> | any
|
|
) => {
|
|
const env = getLocalEnv()
|
|
const credentials = getServiceAccountCredentials(env)
|
|
|
|
await loadSecretsToEnv(credentials)
|
|
|
|
const pg = createSupabaseDirectClient()
|
|
await main({ pg })
|
|
|
|
process.exit()
|
|
}
|