Skip to content

Commit 7566ea6

Browse files
committed
access api directly during the build phase
1 parent 3bbbfc7 commit 7566ea6

File tree

3 files changed

+5
-16
lines changed

3 files changed

+5
-16
lines changed

.github/workflows/deploy.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -72,11 +72,11 @@ jobs:
7272
-e AUTH_SECRET='${{ secrets.AUTH_SECRET }}' \
7373
-e AUTH_GITHUB_SECRET='${{ secrets.AUTH_GITHUB_SECRET }}' \
7474
-e URI_GITRANKS='${{ vars.URI_GITRANKS }}' \
75+
-e URI_GITRANKS_BUILD='${{ secrets.URI_GITRANKS_BUILD }}' \
7576
-e AUTH_GITHUB_ID='${{ vars.AUTH_GITHUB_ID }}' \
7677
-e AUTH_URL='${{ vars.AUTH_URL }}' \
7778
-e AUTH_TRUST_HOST=true \
7879
-e NEXT_PUBLIC_URI='${{ vars.NEXT_PUBLIC_URI }}' \
79-
-e HEAP_SNAPSHOT_TOKEN='${{ secrets.HEAP_SNAPSHOT_TOKEN }}' \
8080
-p 3000:3000 \
8181
-p 127.0.0.1:9229:9229 \
8282
ghcr.io/gitranks/gitranks-ui:latest

app/api/_debug/heap/route.ts

Lines changed: 0 additions & 14 deletions
This file was deleted.

lib/signed-fetch.ts

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,5 +7,8 @@ export async function signedFetch(path: string, init: RequestInit = {}) {
77
const headers = new Headers(init.headers);
88
headers.set('Authorization', `Bearer ${token}`);
99

10-
return fetch(`${process.env.URI_GITRANKS}${path}`, { ...init, headers });
10+
const apiUrl =
11+
process.env.NEXT_PHASE === 'phase-production-build' ? process.env.URI_GITRANKS_BUILD! : process.env.URI_GITRANKS!;
12+
13+
return fetch(`${apiUrl}${path}`, { ...init, headers });
1114
}

0 commit comments

Comments
 (0)