const pgp = require('pg-promise')();

// 连接到数据库
var PgInstanse;
export const pgClient = function(){
    let pgconfig = {
        user: 'postgres',
        password: 'Edu2024textbask',
        host: '127.0.0.1',
        port: 25432,
        database: 'postgres'
    }
    
    if(global.config['LOCAL']) {
        pgconfig = {
            user: 'postgres',
            password: 'postgres',
            host: '127.0.0.1',
            port: 25432,
            database: 'postgres'
        }
    }
    
    if(!PgInstanse){
        console.log(pgconfig)
        PgInstanse = pgp(pgconfig);
    }
    return PgInstanse;
}