feat: add vehicle and hydrogen heatmaps
All checks were successful
ci/woodpecker/push/woodpecker Pipeline was successful
All checks were successful
ci/woodpecker/push/woodpecker Pipeline was successful
This commit is contained in:
29
src/server/heatmap-db.ts
Normal file
29
src/server/heatmap-db.ts
Normal file
@@ -0,0 +1,29 @@
|
||||
import dotenv from 'dotenv';
|
||||
import pg from 'pg';
|
||||
|
||||
dotenv.config();
|
||||
|
||||
const { Pool } = pg;
|
||||
|
||||
const heatmapPool = new Pool({
|
||||
host: process.env.HEATMAP_DB_HOST,
|
||||
port: Number(process.env.HEATMAP_DB_PORT) || 5432,
|
||||
user: process.env.HEATMAP_DB_USER,
|
||||
password: process.env.HEATMAP_DB_PASSWORD,
|
||||
database: process.env.HEATMAP_DB_NAME,
|
||||
ssl: process.env.HEATMAP_DB_SSL === 'true'
|
||||
? { rejectUnauthorized: false }
|
||||
: false,
|
||||
max: 5,
|
||||
idleTimeoutMillis: 30_000,
|
||||
connectionTimeoutMillis: 10_000,
|
||||
statement_timeout: 30_000,
|
||||
application_name: 'ln-bi-vehicle-heatmap',
|
||||
options: '-c timezone=Asia/Shanghai -c default_transaction_read_only=on',
|
||||
});
|
||||
|
||||
heatmapPool.on('error', (error) => {
|
||||
console.error('[vehicle-heatmap] idle PostgreSQL client error:', error);
|
||||
});
|
||||
|
||||
export default heatmapPool;
|
||||
Reference in New Issue
Block a user