Skip to content

Commit

Permalink
More useful identifiers
Browse files Browse the repository at this point in the history
  • Loading branch information
dcramer committed Jan 16, 2025
1 parent 3fe2f94 commit 6d09961
Show file tree
Hide file tree
Showing 4 changed files with 7 additions and 1 deletion.
1 change: 1 addition & 0 deletions apps/server/src/trpc/client.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ export function makeTRPCClient(
apiServer,
accessToken,
batch: false,
userAgent: "@peated (trpc/proxy)",
}),
});
}
Expand Down
4 changes: 3 additions & 1 deletion apps/server/src/trpc/links.ts
Original file line number Diff line number Diff line change
Expand Up @@ -62,10 +62,12 @@ export function getLinks({
apiServer,
accessToken,
batch = true,
userAgent = "peated (trpc/unknown)",
}: {
apiServer: string;
accessToken?: string | null | undefined;
batch: boolean;
userAgent: string;
}) {
return [
loggerLink({
Expand All @@ -80,7 +82,7 @@ export function getLinks({
async headers() {
return {
authorization: accessToken ? `Bearer ${accessToken}` : "",
"user-agent": "peated (trpc)",
"user-agent": userAgent,
};
},
}),
Expand Down
2 changes: 2 additions & 0 deletions apps/web/src/lib/trpc/client.server.ts
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ export async function getTrpcClient(): Promise<CreateQueryUtils<AppRouter>> {
apiServer: config.API_SERVER,
accessToken,
batch: true,
userAgent: "@peated/web (trpc)",
}),
});

Expand All @@ -39,6 +40,7 @@ export async function getUnsafeTrpcClient(): Promise<
apiServer: config.API_SERVER,
accessToken,
batch: true,
userAgent: "@peated/web (trpc/unsafe)",
}),
});
}
1 change: 1 addition & 0 deletions apps/web/src/lib/trpc/provider.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ export default function TRPCProvider({
apiServer,
accessToken,
batch: true,
userAgent: "@peated/web (trpc/react)",
}),
}),
);
Expand Down

0 comments on commit 6d09961

Please sign in to comment.