-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathenv.ts
60 lines (48 loc) · 2.23 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
//
// Types pour les variables d'environnement avec le validateur Valibot.
// Source : https://github.com/t3-oss/t3-env/blob/ac21b7ad1ebfb3958dec6d32cd32b716518c0e43/examples/nextjs/app/env.ts
//
import * as v from "valibot";
const schema = v.object( {
TZ: v.pipe( v.string(), v.minLength( 1 ) ),
NEXT_LOGGING: v.picklist( [ "true", "false" ] ),
NEXT_PUBLIC_ENV: v.picklist( [ "development", "production" ] ),
NEXT_PUBLIC_MAX_QUOTA: v.pipe( v.string(), v.minLength( 1 ) ),
NEXT_PUBLIC_ACCEPTED_FILE_TYPES: v.pipe( v.string(), v.minLength( 1 ) ),
SENTRY_ENABLED: v.picklist( [ "true", "false" ] ),
SENTRY_DSN: v.pipe( v.string(), v.url() ),
SENTRY_ORG: v.pipe( v.string(), v.minLength( 1 ) ),
SENTRY_PROJECT: v.pipe( v.string(), v.minLength( 1 ) ),
SENTRY_AUTH_TOKEN: v.pipe( v.string(), v.minLength( 1 ) ),
NEXT_PUBLIC_RECAPTCHA_ENABLED: v.picklist( [ "true", "false" ] ),
NEXT_PUBLIC_RECAPTCHA_PUBLIC_KEY: v.pipe(
v.string(),
v.length( 40 ),
v.startsWith( "6L" )
),
RECAPTCHA_SECRET_KEY: v.pipe( v.string(), v.length( 40 ), v.startsWith( "6L" ) ),
NEXT_PUBLIC_ANALYTICS_ENABLED: v.picklist( [ "true", "false" ] ),
NEXT_PUBLIC_ANALYTICS_TAG: v.pipe(
v.string(),
v.length( 12 ),
v.startsWith( "G-" )
),
DATABASE_URL: v.pipe( v.string(), v.url() ),
SMTP_HOST: v.pipe( v.string(), v.minLength( 1 ) ),
SMTP_PORT: v.pipe( v.string(), v.minLength( 1 ), v.maxLength( 5 ) ),
SMTP_USERNAME: v.pipe( v.string(), v.minLength( 1 ) ),
SMTP_PASSWORD: v.pipe( v.string(), v.minLength( 1 ) ),
DKIM_DOMAIN: v.pipe( v.string(), v.minLength( 1 ) ),
DKIM_SELECTOR: v.pipe( v.string(), v.minLength( 1 ) ),
DKIM_PRIVATE_KEY: v.pipe( v.string(), v.minLength( 1 ) ),
AUTH_SECRET: v.pipe( v.string(), v.minLength( 1 ) ),
NEXT_PUBLIC_AUTH_GOOGLE_ENABLED: v.picklist( [ "true", "false" ] ),
AUTH_GOOGLE_ID: v.pipe( v.string(), v.minLength( 1 ) ),
AUTH_GOOGLE_SECRET: v.pipe( v.string(), v.minLength( 1 ) ),
NEXT_PUBLIC_AUTH_GITHUB_ENABLED: v.picklist( [ "true", "false" ] ),
AUTH_GITHUB_ID: v.pipe( v.string(), v.minLength( 1 ) ),
AUTH_GITHUB_SECRET: v.pipe( v.string(), v.minLength( 1 ) )
} );
v.parse( schema, process.env );
// Exportation des types pour les variables d'environnement.
export interface ProcessEnv extends v.InferOutput<typeof schema> {}