allow site to run locally without PG env vars

pull/3723/head
Rich Harris 6 years ago
parent aa8503ac51
commit 84b0e86583

@ -14,9 +14,11 @@ const app = polka({
}
});
app.use(
authenticate(),
if (process.env.PGHOST) {
app.use(authenticate);
}
app.use(
sirv('static', {
dev: process.env.NODE_ENV === 'development',
setHeaders(res) {

@ -1,7 +1,7 @@
import { Pool } from 'pg';
// Uses `PG*` ENV vars
export const DB = new Pool();
export const DB = process.env.PGHOST ? new Pool() : null;
export function query(text, values=[]) {
return DB.query(text, values).then(r => r.rows);

Loading…
Cancel
Save