mirror of https://github.com/buster-so/buster.git
try one more time without custom ssl
This commit is contained in:
parent
ece2be1065
commit
1acecff3a4
|
@ -1,6 +1,5 @@
|
|||
import { config } from 'dotenv';
|
||||
import { defineConfig } from 'drizzle-kit';
|
||||
import * as fs from 'fs';
|
||||
|
||||
// Load specific .env file
|
||||
config({ path: '../../.env' }); // or '.env.development', '.env.production', etc.
|
||||
|
@ -11,36 +10,12 @@ if (!connectionString) {
|
|||
throw new Error('DATABASE_URL environment variable is not defined');
|
||||
}
|
||||
|
||||
// Check if we have a certificate file specified
|
||||
const certPath = process.env.DATABASE_SSL_CERT;
|
||||
const isLocalhost = connectionString.includes('localhost') || connectionString.includes('127.0.0.1');
|
||||
|
||||
// Configure SSL based on environment
|
||||
let sslConfig: any = undefined;
|
||||
if (!isLocalhost) {
|
||||
if (certPath && fs.existsSync(certPath)) {
|
||||
// Use the certificate if available
|
||||
sslConfig = {
|
||||
ca: fs.readFileSync(certPath),
|
||||
rejectUnauthorized: true, // With a proper cert, we can validate
|
||||
};
|
||||
console.log('Using SSL certificate from:', certPath);
|
||||
} else {
|
||||
// Fallback to allowing self-signed certificates
|
||||
sslConfig = {
|
||||
rejectUnauthorized: false,
|
||||
};
|
||||
console.log('SSL certificate not found, allowing self-signed certificates');
|
||||
}
|
||||
}
|
||||
|
||||
export default defineConfig({
|
||||
schema: './src/schema.ts',
|
||||
out: './drizzle',
|
||||
dialect: 'postgresql',
|
||||
dbCredentials: {
|
||||
url: connectionString || '',
|
||||
...(sslConfig && { ssl: sslConfig }),
|
||||
},
|
||||
verbose: true,
|
||||
strict: true,
|
||||
|
|
Loading…
Reference in New Issue