aboutsummaryrefslogtreecommitdiffstats
path: root/apps/cli/src/lib
diff options
context:
space:
mode:
Diffstat (limited to 'apps/cli/src/lib')
-rw-r--r--apps/cli/src/lib/trpc.ts17
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}`,
+ };
+ },
+ }),
+ ],
+ });
+}