forked from ethereumfollowprotocol/app
-
Notifications
You must be signed in to change notification settings - Fork 0
/
env.ts
27 lines (23 loc) · 936 Bytes
/
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
import * as v from 'valibot'
export const EnvironmentVariableSchema = v.object({
NODE_ENV: v.union([v.literal('development'), v.literal('production'), v.literal('test')]),
HOST: v.string(),
PORT: v.number(),
NEXT_PUBLIC_SITE_URL: v.string('NEXT_PUBLIC_SITE_URL must be a string', [v.url()]),
APP_VERSION: v.string(),
EFP_API_URL: v.string('EFP_API_URL must be a string', [v.url()]),
NEXT_PUBLIC_EFP_API_URL: v.string('NEXT_PUBLIC_EFP_API_URL must be a string', [v.url()]),
NEXT_PUBLIC_WALLET_CONNECT_PROJECT_ID: v.string(
'NEXT_PUBLIC_WALLET_CONNECT_PROJECT_ID must be a string'
)
})
export type EnvironmentVariable = v.Input<typeof EnvironmentVariableSchema>
export const {
success,
output: env,
issues
} = v.safeParse(EnvironmentVariableSchema, process.env, { abortEarly: true, abortPipeEarly: true })
if (!success) {
// console.error(issues)
throw new Error('Environment variables are invalid')
}