v0.1.8 - 백엔드 초안 추가
This commit is contained in:
17
backend/src/config.js
Normal file
17
backend/src/config.js
Normal file
@@ -0,0 +1,17 @@
|
||||
import { config } from 'dotenv'
|
||||
import path from 'node:path'
|
||||
import { fileURLToPath } from 'node:url'
|
||||
import { z } from 'zod'
|
||||
|
||||
const __filename = fileURLToPath(import.meta.url)
|
||||
const __dirname = path.dirname(__filename)
|
||||
|
||||
config({ path: path.join(__dirname, '..', '.env') })
|
||||
|
||||
const envSchema = z.object({
|
||||
PORT: z.coerce.number().default(3001),
|
||||
DB_FILE: z.string().default('./data/planner.sqlite'),
|
||||
CORS_ORIGIN: z.string().default('http://localhost:5173'),
|
||||
})
|
||||
|
||||
export const env = envSchema.parse(process.env)
|
||||
Reference in New Issue
Block a user