Skip to content

Commit 0d5bad0

Browse files
authored
Merge pull request #58 from tinybirdco/fixes02
Fixes02
2 parents 332c4e6 + f8fe25b commit 0d5bad0

File tree

6 files changed

+21
-7
lines changed

6 files changed

+21
-7
lines changed

.gitignore

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,3 +2,6 @@
22
.venv
33
.tinyb
44
.tmp
5+
.tb_error*
6+
tinybird/fixtures
7+

TEMPLATE.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,6 @@ Fork the GitHub repository and deploy the data project to Tinybird.
66

77
## Set up the dashboard
88

9-
Deploy the dashboard to Vercel or use the hosted dashboard at https://dsat.tinybird.co/ using the Workspace admin [token](https://app.tinybird.co/tokens).
9+
Deploy the dashboard to Vercel or use the hosted dashboard at https://dsat.tinybird.app/ using the Workspace admin [token](https://app.tinybird.co/tokens).
1010

1111
Configure webhooks for the services you want to ingest. See instructions in the [README](https://github.com/tinybirdco/dev-stack-analytics-template/blob/main/README.md).

apps/web/src/app/api/datasources/route.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ export async function GET(request: Request) {
88
return NextResponse.json({ error: 'Token is required' }, { status: 400 });
99
}
1010

11-
const response = await fetch('https://api.tinybird.co/v0/datasources', {
11+
const response = await fetch(`${process.env.NEXT_PUBLIC_TINYBIRD_API_HOST}/v0/datasources`, {
1212
headers: {
1313
'Authorization': `Bearer ${token}`,
1414
},

apps/web/src/app/api/pipes/route.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
import { NextRequest, NextResponse } from "next/server";
22

3-
const TINYBIRD_API_URL = "https://api.tinybird.co/v0/pipes";
3+
const TINYBIRD_API_URL = `${process.env.NEXT_PUBLIC_TINYBIRD_API_HOST}/v0/pipes`;
44

55
export async function GET(request: NextRequest) {
66
const searchParams = request.nextUrl.searchParams;

apps/web/src/app/api/query/route.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ export async function GET(request: Request) {
99
return NextResponse.json({ error: 'Token and query are required' }, { status: 400 });
1010
}
1111

12-
const url = new URL('https://api.tinybird.co/v0/sql');
12+
const url = new URL(`${process.env.NEXT_PUBLIC_TINYBIRD_API_HOST}/v0/sql`);
1313
url.searchParams.set('q', query);
1414

1515
const response = await fetch(url.toString(), {

apps/web/src/lib/constants.ts

Lines changed: 14 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,19 @@
11
import dynamic from 'next/dynamic';
22

3-
export const baseURL = process.env.NEXT_PUBLIC_VERCEL_URL
4-
? `https://${process.env.NEXT_PUBLIC_VERCEL_URL}`
5-
: 'http://localhost:3000';
3+
export const baseURL = (() => {
4+
// Preview deployments
5+
if (process.env.NEXT_PUBLIC_VERCEL_ENV === 'preview') {
6+
return `https://${process.env.NEXT_PUBLIC_VERCEL_BRANCH_URL}`;
7+
}
8+
9+
// Production URL
10+
if (process.env.NEXT_PUBLIC_VERCEL_URL) {
11+
return `https://${process.env.NEXT_PUBLIC_VERCEL_URL}`;
12+
}
13+
14+
// Local development
15+
return 'http://localhost:3000';
16+
})();
617

718
export type ToolState = 'available' | 'installed' | 'configured';
819

0 commit comments

Comments
 (0)