-
-
Notifications
You must be signed in to change notification settings - Fork 45
/
env.ts
62 lines (55 loc) · 1.52 KB
/
env.ts
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
import { createEnv } from '@t3-oss/env-nextjs';
import { vercel } from '@t3-oss/env-nextjs/presets';
import { z } from 'zod';
const safeJSONParse = (input: string) => {
try {
return JSON.parse(input);
} catch {
return input;
}
};
export const env = createEnv({
extends: [vercel()],
server: {
NODE_ENV: z.enum(['development', 'production', 'test']).optional(),
SITE_URL: z.string().url().optional(),
INTERNAL_API_SECRET: z.string().min(1),
ALLOWED_BOTS: z
.string()
.transform(safeJSONParse)
.pipe(z.array(z.string()))
.optional(),
GOOGLE_SERVICE_KEY_B64: z.string().optional(),
BIGQUERY_DATASET: z.string().optional(),
BIGQUERY_LOCATION: z.string().optional(),
GITHUB_TOKEN: z.string().optional(),
GITHUB_SPONSORS_FEATURED_TIERS: z
.string()
.transform(safeJSONParse)
.pipe(z.array(z.string()))
.optional(),
SPONSORS: z
.string()
.transform(safeJSONParse)
.pipe(
z.array(
z.object({
id: z.string(),
name: z.string(),
logoUrl: z.string(),
url: z.string(),
}),
),
)
.optional(),
},
client: {
NEXT_PUBLIC_PLAUSIBLE_DOMAIN: z.string().optional(),
NEXT_PUBLIC_PLAUSIBLE_HOST: z.string().optional(),
},
experimental__runtimeEnv: {
NEXT_PUBLIC_PLAUSIBLE_DOMAIN: process.env.NEXT_PUBLIC_PLAUSIBLE_DOMAIN,
NEXT_PUBLIC_PLAUSIBLE_HOST: process.env.NEXT_PUBLIC_PLAUSIBLE_HOST,
},
emptyStringAsUndefined: true,
});