Skip to content

Commit e596507

Browse files
committed
fix: dev env vars
1 parent 14d087c commit e596507

File tree

3 files changed

+29
-16
lines changed

3 files changed

+29
-16
lines changed

src/server/auth.server.ts

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,10 @@ import { betterAuthComponent } from '../../convex/auth'
77

88
// You'll want to replace this with an environment variable
99
const siteUrl = process.env.URL
10+
const convexSiteUrl =
11+
process.env.NODE_ENV === 'production'
12+
? process.env.VITE_CONVEX_SITE_URL!
13+
: 'http://upbeat-greyhound-631.convex.site'
1014

1115
export const createAuth = (ctx: GenericCtx) =>
1216
betterAuth({
@@ -33,5 +37,5 @@ export const createAuth = (ctx: GenericCtx) =>
3337

3438
export const { fetchSession, reactStartHandler, getCookieName } =
3539
reactStartHelpers(createAuth, {
36-
convexSiteUrl: process.env.VITE_CONVEX_SITE_URL!,
40+
convexSiteUrl,
3741
})

src/server/sponsors.ts

Lines changed: 22 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,6 @@ import { extent, scaleLinear } from 'd3'
88
export type SponsorMeta = {
99
login: string
1010
name?: string
11-
email?: string
1211
imageUrl?: string
1312
linkUrl?: string
1413
private?: boolean
@@ -18,7 +17,6 @@ export type SponsorMeta = {
1817
export type Sponsor = {
1918
login: string
2019
name: string
21-
email: string
2220
imageUrl: string
2321
linkUrl: string
2422
private: boolean
@@ -69,7 +67,6 @@ export async function getSponsors() {
6967
if (matchingSponsor) {
7068
Object.assign(matchingSponsor, {
7169
name: sponsorMeta.name ?? matchingSponsor.name,
72-
email: sponsorMeta.email ?? matchingSponsor.email,
7370
imageUrl: sponsorMeta.imageUrl ?? matchingSponsor.imageUrl,
7471
linkUrl: sponsorMeta.linkUrl ?? matchingSponsor.linkUrl,
7572
private: sponsorMeta.private ?? matchingSponsor.private,
@@ -78,7 +75,6 @@ export async function getSponsors() {
7875
sponsors.push({
7976
login: sponsorMeta.login,
8077
name: sponsorMeta.name || '',
81-
email: sponsorMeta.email || '',
8278
imageUrl: sponsorMeta.imageUrl || '',
8379
linkUrl: sponsorMeta.linkUrl || '',
8480
private: sponsorMeta.private || false,
@@ -116,12 +112,12 @@ async function getGithubSponsors() {
116112
... on User {
117113
name
118114
login
119-
email
115+
// email
120116
}
121117
... on Organization {
122118
name
123119
login
124-
email
120+
// email
125121
}
126122
}
127123
tier {
@@ -159,12 +155,11 @@ async function getGithubSponsors() {
159155
return null
160156
}
161157

162-
const { name, login, email } = sponsorEntity
158+
const { name, login } = sponsorEntity
163159

164160
return {
165161
name,
166162
login,
167-
email,
168163
amount: tier?.monthlyPriceInDollars || 0,
169164
createdAt,
170165
private: privacyLevel === 'PRIVATE',
@@ -183,7 +178,25 @@ async function getGithubSponsors() {
183178
} catch (err: any) {
184179
if (err.status === 401) {
185180
console.error('Missing github credentials, returning mock data.')
186-
return []
181+
return [
182+
'tannerlinsley',
183+
'tkdodo',
184+
'crutchcorn',
185+
'kevinvandy',
186+
'jherr',
187+
'seancassiere',
188+
'schiller-manuel',
189+
].flatMap((d, i1) =>
190+
new Array(20).fill(d).map((d, i2) => ({
191+
login: d,
192+
name: d,
193+
amount: (20 - i2) / 20 + Math.random(),
194+
createdAt: new Date().toISOString(),
195+
private: false,
196+
linkUrl: `https://github.com/${d}`,
197+
imageUrl: `https://github.com/${d}.png`,
198+
}))
199+
)
187200
}
188201
if (err.status === 403) {
189202
console.error('GitHub rate limit exceeded, returning empty sponsors.')

src/utils/env.ts

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -11,12 +11,8 @@ const serverEnvSchema = z.object({
1111
})
1212

1313
const clientEnvSchema = z.object({
14-
VITE_CONVEX_SITE_URL: z
15-
.string()
16-
.default('http://upbeat-greyhound-631.convex.site'),
17-
VITE_CONVEX_URL: z
18-
.string()
19-
.default('http://upbeat-greyhound-631.convex.cloud'),
14+
VITE_CONVEX_SITE_URL: z.string().optional(),
15+
VITE_CONVEX_URL: z.string().optional(),
2016
URL: z.string().optional(),
2117
})
2218

0 commit comments

Comments
 (0)