mirror of
https://github.com/cheveguerra/bot-whatsapp.git
synced 2026-04-19 03:59:17 +00:00
fix(provider): ⚡ edit starter
This commit is contained in:
@@ -1,23 +1,20 @@
|
||||
require('dotenv').config()
|
||||
const { MongoClient } = require('mongodb')
|
||||
|
||||
const DB_URI = process.env.DB_URI || 'mongodb://0.0.0.0:27017'
|
||||
const DB_NAME = process.env.DB_NAME || 'db_bot'
|
||||
|
||||
class MongoAdapter {
|
||||
db
|
||||
listHistory = []
|
||||
|
||||
constructor() {
|
||||
credentials = { dbUri: null, dbName: null }
|
||||
constructor(_credentials) {
|
||||
this.credentials = _credentials
|
||||
this.init().then()
|
||||
}
|
||||
|
||||
init = async () => {
|
||||
try {
|
||||
const client = new MongoClient(DB_URI, {})
|
||||
const client = new MongoClient(this.credentials.dbUri, {})
|
||||
await client.connect()
|
||||
console.log('🆗 Conexión Correcta DB')
|
||||
const db = client.db(DB_NAME)
|
||||
const db = client.db(this.credentials.dbName)
|
||||
this.db = db
|
||||
return true
|
||||
} catch (e) {
|
||||
|
||||
@@ -3,7 +3,7 @@ const mysql = require('mysql2')
|
||||
class MyslAdapter {
|
||||
db
|
||||
listHistory = []
|
||||
credentials = { host: null, user: null, database: null }
|
||||
credentials = { host: null, user: null, database: null, password: null }
|
||||
|
||||
constructor(_credentials) {
|
||||
this.credentials = _credentials
|
||||
|
||||
Reference in New Issue
Block a user