Skip to content

Commit

Permalink
Merge pull request #38 from Adamant-im/dev
Browse files Browse the repository at this point in the history
v2.0.1 (hotfix)
  • Loading branch information
adamant-al authored Apr 4, 2024
2 parents 283fef1 + 9de1ed6 commit 2a413d3
Show file tree
Hide file tree
Showing 4 changed files with 121 additions and 89 deletions.
5 changes: 3 additions & 2 deletions modules/DB.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,12 @@ const mongoClient = new MongoClient('mongodb://127.0.0.1:27017/', { serverSelect
const model = require('../helpers/dbModel');
const config = require('./config/reader');

const dbName = 'coinoptimusdb';
const collections = {};

mongoClient.connect()
.then((client) => {
const db = client.db('tradebotdb');
const db = client.db(dbName);

collections.db = db;

Expand All @@ -28,7 +29,7 @@ mongoClient.connect()
collections.incomingTxsDb = model(incomingTxsCollection);
collections.systemDb = model(db.collection('systems'));

log.log(`${config.notifyName} successfully connected to 'coinoptimusdb' MongoDB.`);
log.log(`${config.notifyName} successfully connected to '${dbName}' MongoDB.`);
})
.catch((error) => {
log.error(`Unable to connect to MongoDB: ${error}`);
Expand Down
11 changes: 7 additions & 4 deletions modules/config/reader.js
Original file line number Diff line number Diff line change
Expand Up @@ -30,11 +30,10 @@ try {
config.passPhrase = undefined;
}

if (!config.cli) {
if (process.env.CLI_MODE_ENABLED) {
exit('CLI is disabled in the config.');
}
const isCliEnabled = config.cli;
const isTgEnabled = config.manageTelegramBotToken;

if (!isCliEnabled && !isTgEnabled) {
if (!config.passPhrase) {
exit('Bot\'s config is wrong. ADAMANT passPhrase is invalid.');
}
Expand All @@ -44,6 +43,10 @@ try {
}
}

if (process.env.CLI_MODE_ENABLED && !isCliEnabled) {
exit('You are running the bot in CLI mode, but it\'s disabled in the config.');
}

let keyPair;
let address;
let cliString;
Expand Down
Loading

0 comments on commit 2a413d3

Please sign in to comment.