Skip to content

Commit

Permalink
add 2 device conditions
Browse files Browse the repository at this point in the history
  • Loading branch information
Kry9toN committed Jan 29, 2021
1 parent 94c4b4d commit 432b049
Showing 1 changed file with 11 additions and 2 deletions.
13 changes: 11 additions & 2 deletions src/utils/db.ts
Original file line number Diff line number Diff line change
@@ -1,11 +1,20 @@
export {}
require('dotenv').config()
const { Pool } = require('pg')
const pool = new Pool({
const optionsAndoid = {
user: process.env.DB_USER,
host: process.env.DB_HOST,
database: process.env.DB_NAME,
password: process.env.DB_PW,
port: 5432
}
const options = {
connectionString: process.env.DATABASE_URL,
connectionTimeoutMillis: 2500,
idleTimeoutMillis: 2000,
max: 10000
})
}
const pool = new Pool(process.platform == 'android' ? optionsAndoid : options)

const databaseInput = (value: string) => new Promise((resolve, reject) => {
pool.query(value, (err: string, result: any) => {
Expand Down

0 comments on commit 432b049

Please sign in to comment.