Read Config re implemented

This commit is contained in:
Luis Fernando Molina committed 2018-03-07 17:27:36 +01:00
1 parent ad0a319106
commit 1af473ee9c
4 files changed
+12 -8

No files matched your search

Binary file not shown.
+7 -7
View File
@@ -8,7 +8,6 @@ exports.newAzureFileStorage = function newAzureFileStorage(BOT) {
const MODULE_NAME = "Azure File Storage";
var fs = require('fs');
var util = require('util');
var guid = require('node-uuid');
var crypto = require('crypto');
@@ -59,15 +58,16 @@ exports.newAzureFileStorage = function newAzureFileStorage(BOT) {
function readConfig() {
try {
return JSON.parse(fs.readFileSync(ROOT_DIR + dataOwner + '.azure.storage.connstring', 'utf8'));
let fs = require('fs');
let filePath = '../' + 'Connection-Strings' + '/' + global.RUNNING_MODE + '/' + dataOwner + '.azure.storage.connstring' + '.json';
return JSON.parse(fs.readFileSync(filePath, 'utf8'));
}
catch (err) {
const logText = "[ERROR] 'readConfig' - ERROR : " + err.message;
logger.write(logText);
logger.write("[ERROR] readConfig -> err = " + err.message);
logger.write("[HINT] You need to have a file at this path -> " + filePath);
logger.write("[HINT] The file must have the connection string to the Azure Storage Account. Request the file to an AA Team Member if you dont have it.");
callBackFunction(global.DEFAULT_FAIL_RESPONSE);
}
}
function createFolder(folderPath, callBackFunction) {
+1 -1
View File
@@ -42,7 +42,7 @@
try {
let fs = require('fs');
let filePath = '../' + 'API-Keys' + '/' + EXCHANGE_NAME + '.json';
let filePath = '../' + 'API-Keys' + '/' + bot.codeName + '.' + EXCHANGE_NAME + '.json';
return JSON.parse(fs.readFileSync(filePath, 'utf8'));
}
catch (err) {
+4
View File
@@ -1,6 +1,10 @@
const LOG_INFO = true;
/* The following global variable tells the system if it is running on test mode or production. */
global.RUNNING_MODE = 'Testnet'; // or 'Production'
/* First thing to do is to read the config and guess which bot we will be running. */
var fs = require('fs');