Commit 326f383 1 parent 93a0acd commit 326f383 Copy full SHA for 326f383
File tree 2 files changed +10
-3
lines changed
2 files changed +10
-3
lines changed Original file line number Diff line number Diff line change 1
1
import 'dotenv/config' ;
2
2
import type { Config } from 'drizzle-kit' ;
3
+
4
+ const isRunningLocally = ( ) =>
5
+ process . env . NUXT_DB_HOST ?. includes ( 'localhost' ) || process . env . NUXT_DB_HOST ?. includes ( '127.0.0.1' ) ;
6
+
3
7
export default {
4
8
schema : './server/db/schema.ts' ,
5
9
out : './server/db/migrations' ,
@@ -10,6 +14,6 @@ export default {
10
14
user : process . env . NUXT_DB_USER ! ,
11
15
password : process . env . NUXT_DB_PASSWORD ! ,
12
16
database : process . env . NUXT_DB_DATABASE ! ,
13
- ssl : false ,
17
+ ssl : ! isRunningLocally ( ) ,
14
18
} ,
15
19
} satisfies Config ;
Original file line number Diff line number Diff line change @@ -5,6 +5,9 @@ import pg from 'pg';
5
5
let client : pg . Client | null ;
6
6
let drizzleInstance : NodePgDatabase ;
7
7
8
+ const isRunningLocally = ( ) =>
9
+ process . env . NUXT_DB_HOST ?. includes ( 'localhost' ) || process . env . NUXT_DB_HOST ?. includes ( '127.0.0.1' ) ;
10
+
8
11
export async function useDatabase ( ) {
9
12
try {
10
13
const config = useRuntimeConfig ( ) ;
@@ -14,10 +17,10 @@ export async function useDatabase() {
14
17
15
18
client = new pg . Client ( {
16
19
...config . db ,
17
- ssl : IS_DEV
20
+ ssl : isRunningLocally ( )
18
21
? false
19
22
: {
20
- rejectUnauthorized : false , // TODO: fix this.
23
+ rejectUnauthorized : false ,
21
24
} ,
22
25
} ) ;
23
26
You can’t perform that action at this time.
0 commit comments