Skip to content

Commit

Permalink
Add back tefca.env for easier local development in QC
Browse files Browse the repository at this point in the history
  • Loading branch information
robertandremitchell committed Oct 9, 2024
1 parent 565256e commit cd5eb1b
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 2 deletions.
7 changes: 5 additions & 2 deletions containers/tefca-viewer/src/app/database-service.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
"use server";
import { Pool, PoolConfig, QueryResultRow } from "pg";
// import dotenv from "dotenv";
import dotenv from "dotenv";
import { ValueSetItem, valueSetTypeToClincalServiceTypeMap } from "./constants";

const getQuerybyNameSQL = `
Expand All @@ -13,7 +13,10 @@ select q.query_name, q.id, qtv.valueset_id, vs.name as valueset_name, vs.author
where q.query_name = $1;
`;

// Load environment variables from .env and establish a Pool configuration
// Load environment variables from tefca.env if not in production
if (process.env.NODE_ENV !== "production") {
dotenv.config({ path: "tefca.env" });
}
const dbConfig: PoolConfig = {
connectionString: process.env.DATABASE_URL,
max: 10, // Maximum # of connections in the pool
Expand Down
1 change: 1 addition & 0 deletions containers/tefca-viewer/tefca.env
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
DATABASE_URL=postgresql://postgres:pw@localhost:5432/tefca_db

0 comments on commit cd5eb1b

Please sign in to comment.