Skip to content

Commit

Permalink
setting database credentials inside config file
Browse files Browse the repository at this point in the history
  • Loading branch information
ashaban committed Dec 20, 2023
1 parent 4a9a766 commit c5a79d6
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,13 @@
"path": "/var/lib/gofr/gofr-backend/lib"
}
},
"database": {
"dbname": "hapi",
"username": "hapi",
"password": "hapi",
"host": "localhost",
"port": 5432
},
"server": {
"hostname": "0.0.0.0",
"port": 4000
Expand Down
11 changes: 6 additions & 5 deletions gofr-backend/lib/modules/postgres.js
Original file line number Diff line number Diff line change
@@ -1,10 +1,11 @@
const { Pool, escapeLiteral } = require("pg");
const config = require('../config');

const pool = new Pool({
database: "gofr",
user: "hapi",
password: "hapi",
port: 5432,
host: "localhost",
database: config.get('database:dbname'),
user: config.get('database:username'),
password: config.get('database:password'),
port: config.get('database:port'),
host: config.get('database:host')
});
module.exports = { pool, escapeLiteral };

0 comments on commit c5a79d6

Please sign in to comment.