UNPKG

@opengis/fastify-table

Version:

core-plugins

23 lines (20 loc) 609 B
import pg from 'pg'; import config from '../../../config.js'; import init from './funcs/init.js'; const pgClients = {}; if (config.pg) { const client = new pg.Pool({ host: config.pg?.host || '127.0.0.1', port: config.pg?.port || 5432, database: config.pg?.database || 'postgres', user: config.pg?.user || 'postgres', password: config.pg?.password || 'postgres', statement_timeout: config.pg?.statement_timeout || 10000, }); client.init = async () => { await init(client); }; client.init(); pgClients.client = client; } export default pgClients;