diff --git a/lib/index.js b/lib/index.js index 14519ed..4327433 100644 --- a/lib/index.js +++ b/lib/index.js @@ -3,6 +3,8 @@ const Pool = require("pg-pool"), let databaseUrl = process.env.DATABASE_URL +let logSql = process.env.LOG_SQL + if (!databaseUrl) { throw new Error("Environment variable is not set"); } @@ -25,7 +27,9 @@ let pool = new Pool(config); let query = (text, values_in) => { let values = values_in || []; - console.log("SQL: " + text + " with values " + values.join(",")); + if (logSql){ + console.log("SQL: " + text + " with values " + values.join(",")); + } return pool.query(text, values) };