Allow non-SSL postgres to support supabase

This commit is contained in:
Sam Becker 2024-04-30 18:27:58 -05:00
parent 9d7c9de555
commit 0d88437034
2 changed files with 5 additions and 1 deletions

View File

@ -1,7 +1,9 @@
import { POSTGRES_SSL_ENABLED } from '@/site/config';
import { Pool, QueryResult, QueryResultRow } from 'pg';
const pool = new Pool({
connectionString: process.env.POSTGRES_URL,
...POSTGRES_SSL_ENABLED && { ssl: true },
});
export type Primitive = string | number | boolean | undefined | null;

View File

@ -52,7 +52,8 @@ export const SITE_DESCRIPTION =
// STORAGE: DATABASE
export const HAS_DATABASE =
(process.env.POSTGRES_URL ?? '').length > 0;
export const POSTGRES_SSL_ENABLED =
process.env.DISABLE_POSTGRES_SSL === '1' ? false : true;
// STORAGE: VERCEL KV
export const HAS_VERCEL_KV =
(process.env.KV_URL ?? '').length > 0;
@ -133,6 +134,7 @@ export const HIGH_DENSITY_GRID = GRID_ASPECT_RATIO <= 1;
export const CONFIG_CHECKLIST_STATUS = {
hasDatabase: HAS_DATABASE,
isPostgresSSLEnabled: POSTGRES_SSL_ENABLED,
hasVercelKV: HAS_VERCEL_KV,
hasVercelBlobStorage: HAS_VERCEL_BLOB_STORAGE,
hasCloudflareR2Storage: HAS_CLOUDFLARE_R2_STORAGE,