Skip to content

Commit f3c4f7e

Browse files
committed
fix
1 parent f578f43 commit f3c4f7e

File tree

1 file changed

+1
-21
lines changed

1 file changed

+1
-21
lines changed

apps/sim/drizzle.config.ts

Lines changed: 1 addition & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -1,31 +1,11 @@
1-
import fs from 'fs'
2-
import os from 'os'
3-
import path from 'path'
41
import type { Config } from 'drizzle-kit'
52
import { env } from './lib/env'
63

74
const connectionString = env.POSTGRES_URL ?? env.DATABASE_URL
85

96
let sslConfig: { rejectUnauthorized: boolean; ca: string } | undefined
107
if (env.DATABASE_SSL_CERT) {
11-
const tmpDir = process.env.TMPDIR || os.tmpdir()
12-
const tmpPath = path.join(tmpDir, `sim-db-ca-${process.pid}.crt`)
13-
try {
14-
fs.writeFileSync(tmpPath, env.DATABASE_SSL_CERT, { encoding: 'utf-8', mode: 0o600 })
15-
sslConfig = { rejectUnauthorized: true, ca: tmpPath }
16-
17-
const cleanup = () => {
18-
try {
19-
fs.rmSync(tmpPath)
20-
} catch {}
21-
}
22-
23-
process.once('exit', cleanup)
24-
process.once('SIGINT', cleanup)
25-
process.once('SIGTERM', cleanup)
26-
} catch {
27-
// If writing fails, leave sslConfig undefined and allow connection to fail fast
28-
}
8+
sslConfig = { rejectUnauthorized: true, ca: env.DATABASE_SSL_CERT }
299
}
3010

3111
export default {

0 commit comments

Comments
 (0)