From 616f17f99040b959f764ec63e9d2820d7b64193b Mon Sep 17 00:00:00 2001 From: "mati108@gmail.com" <34651529+matbenitez@users.noreply.github.com> Date: Sat, 17 Nov 2018 12:37:07 -0300 Subject: [PATCH] Removing secrets file and adding paramater for the execution config --- Run.js | 37 ++++++++----------------------------- 1 file changed, 8 insertions(+), 29 deletions(-) diff --git a/Run.js b/Run.js index f930cb063..c2324344f 100644 --- a/Run.js +++ b/Run.js @@ -124,7 +124,13 @@ function readExecutionConfiguration() { let filePath; try { let fs = require('fs'); - filePath = './configs/Execution.Config.json'; + + let configDirectory = process.argv[2]; + if(configDirectory === undefined){ + console.log("[ERROR] Configuration file not passed as a command line argument."); + return; + } + filePath = configDirectory +'/Execution.Config.json'; let executionProperties = JSON.parse(fs.readFileSync(filePath, 'utf8')); global.DEV_TEAM = executionProperties.devTeam; global.USER_LOGGED_IN = executionProperties.userName; @@ -135,7 +141,7 @@ function readExecutionConfiguration() { startMode: executionProperties.startMode }; - readExchangeAPIKey(); + startRoot(); } catch (err) { console.log("[ERROR] readExecutionConfiguration -> err = " + err.message); @@ -143,33 +149,6 @@ function readExecutionConfiguration() { } } -//TODO Move this method inside ExchangeAPI -function readExchangeAPIKey() { - - try { - console.log( "[INFO] Run -> readExchangeAPIKey -> Entering function. "); - - let fs = require('fs'); - let filePath = './configs/Secret.Keys' + '.json'; - - global.EXCHANGE_KEYS = JSON.parse(fs.readFileSync(filePath, 'utf8')); - startRoot(); - } - catch (err) { - console.log("[ERROR] Run -> readExchangeAPIKey -> err = " + err.message); - console.log("[HINT] Run -> You need to have a file at this path -> " + filePath); - - global.EXCHANGE_KEYS = { - Poloniex: [{ - Key: "", - Secret: "" - }] - } - - startRoot(); - } -} - function startRoot() { console.log( "[INFO] Run -> startRoot -> Entering function. ");