salman0ansari / whatsapp-api-nodejs

RESTful WhatsApp API with Multiple Device Support
GNU General Public License v3.0
1.28k stars 607 forks source link

Suggestion DB Multiple config #682

Closed diemesolutions closed 1 year ago

diemesolutions commented 1 year ago

Hello!

suggestion for mult databases .env MONGODB_ENABLED=true MONGODB_URL=mongodb://127.0.0.1:27017/WHATS_API01 MONGODB_DB="whats-api01"

src/config/config.js const PORT = process.env.PORT || '3333' //porta atual const CLIENT_PLATFORM = process.env.CLIENT_PLATFORM || 'ConexaoWhatsapp' const DB_USAR = process.env.MONGODB_DB || 'whats-api07' //add

module.exports = { db_usar: DB_USAR, //adicionar por volta da linha 49

src/class/session.js //const db = mongoClient.db('whatsapp-api') const db = mongoClient.db(config.db_usar)

src/class/instance.js //this.collection = mongoClient.db('whatsapp-api').collection(this.key) this.collection = mongoClient.db(config.db_usar).collection(this.key) por volta da linha 74

this form it is possible define db to use

salman0ansari commented 1 year ago

no.

diemesolutions commented 1 year ago

what would be the reason, on mine it worked fine