0e19aa0521
- Implemented Error Log API to capture and store error logs from various services. - Updated admin_ui to include Error Log Viewer component for inspecting logs. - Enhanced error handling in auth_api, employee_api, and transit_api to report errors to the Error Log API. - Modified existing services to utilize the new error logging functionality. - Updated Docker Compose configuration to include the Error Log API service. - Added error logging service in bus_terminal for Flutter application.
27 lines
603 B
JavaScript
27 lines
603 B
JavaScript
const { Pool } = require('pg');
|
|
require('dotenv').config();
|
|
|
|
const pool = new Pool({
|
|
host: process.env.PG_HOST,
|
|
port: process.env.PG_PORT,
|
|
user: process.env.PG_USER,
|
|
password: process.env.PG_PASS,
|
|
database: process.env.PG_DB,
|
|
options: '-c search_path=data,public',
|
|
max: 10,
|
|
idleTimeoutMillis: 30000,
|
|
});
|
|
|
|
pool.query('SELECT 1')
|
|
.then(() => console.log('PostgreSQL connection OK'))
|
|
.catch(err => {
|
|
console.error('PostgreSQL connection FAILED');
|
|
console.error(err);
|
|
process.exit(1);
|
|
});
|
|
|
|
module.exports = {
|
|
query: (text, params) => pool.query(text, params),
|
|
pool,
|
|
};
|