1234567891011121314151617 |
- const pgp = require('pg-promise')();
- // 连接到数据库
- var PgInstanse;
- export const pgClient = function(){
- let pgConns = global.config['DATABASE_DBNAME']
-
- if(global.config['LOCAL']) {
- pgConns = `postgres://postgres:postgres@127.0.0.1:25432/postgres`
- }
-
- if(!PgInstanse){
- // console.log(pgconfig)
- PgInstanse = pgp(pgConns);
- }
- return PgInstanse;
- }
|