-
Notifications
You must be signed in to change notification settings - Fork 22
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(api/env): add relevant env vars
- Loading branch information
1 parent
29303eb
commit 07a3096
Showing
3 changed files
with
51 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
import process from 'node:process' | ||
import { createEnv } from '@t3-oss/env-nextjs' | ||
import { z } from 'zod' | ||
|
||
export const sharedEnv = createEnv({ | ||
shared: { | ||
NODE_ENV: z.enum(['development', 'test', 'production']).optional(), | ||
}, | ||
runtimeEnv: { | ||
NODE_ENV: process.env.NODE_ENV, | ||
}, | ||
}) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
import process from 'node:process' | ||
import { createEnv } from '@t3-oss/env-nextjs' | ||
import { z } from 'zod' | ||
|
||
import { sharedEnv } from '../shared' | ||
|
||
export const env = createEnv({ | ||
extends: [sharedEnv], | ||
server: { | ||
DATABASE_URL: z.string().url().startsWith('postgres'), | ||
}, | ||
experimental__runtimeEnv: {}, | ||
emptyStringAsUndefined: true, | ||
skipValidation: !!process.env.SKIP_ENV_VALIDATION, | ||
}) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
import process from 'node:process' | ||
import { createEnv } from '@t3-oss/env-nextjs' | ||
import { z } from 'zod' | ||
|
||
import { sharedEnv } from '../shared' | ||
import { env as dbEnv } from './db' | ||
|
||
export const env = createEnv({ | ||
extends: [sharedEnv, dbEnv], | ||
shared: { | ||
PORT: z.coerce.number().default(3000), | ||
}, | ||
server: { | ||
AUTH_SECRET: z.string(), | ||
|
||
AUTH_GOOGLE_ID: z.string().optional(), | ||
AUTH_GOOGLE_SECRET: z.string().optional(), | ||
}, | ||
experimental__runtimeEnv: { | ||
PORT: process.env.PORT, | ||
}, | ||
emptyStringAsUndefined: true, | ||
// skipValidation: !!process.env.['SKIP_ENV_VALIDATION'], | ||
}) |