diff options
Diffstat (limited to 'apps/cli/src/lib')
| -rw-r--r-- | apps/cli/src/lib/trpc.ts | 17 |
1 files changed, 17 insertions, 0 deletions
diff --git a/apps/cli/src/lib/trpc.ts b/apps/cli/src/lib/trpc.ts index e6c5555d..deb5c392 100644 --- a/apps/cli/src/lib/trpc.ts +++ b/apps/cli/src/lib/trpc.ts @@ -21,3 +21,20 @@ export function getAPIClient() { ], }); } + +export function getAPIClientFor(opts: { serverAddr: string; apiKey: string }) { + return createTRPCClient<AppRouter>({ + links: [ + httpBatchLink({ + url: `${opts.serverAddr}/api/trpc`, + maxURLLength: 14000, + transformer: superjson, + headers() { + return { + authorization: `Bearer ${opts.apiKey}`, + }; + }, + }), + ], + }); +} |
