운영 시작 버전 v1.0.0 정리
This commit is contained in:
@@ -2,6 +2,12 @@ import postgres from 'postgres'
|
||||
|
||||
let client = null
|
||||
|
||||
/**
|
||||
* 현재 실행 환경이 운영인지 확인한다.
|
||||
* @returns {boolean} 운영 환경 여부
|
||||
*/
|
||||
const isProductionRuntime = () => process.env.NODE_ENV === 'production'
|
||||
|
||||
/**
|
||||
* PostgreSQL 클라이언트 조회
|
||||
* @returns {ReturnType<typeof postgres> | null} PostgreSQL 클라이언트
|
||||
@@ -10,6 +16,10 @@ export const getPostgresClient = () => {
|
||||
const config = useRuntimeConfig()
|
||||
|
||||
if (!config.databaseUrl) {
|
||||
if (isProductionRuntime()) {
|
||||
throw new Error('DATABASE_URL_REQUIRED')
|
||||
}
|
||||
|
||||
return null
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user