From 4027f54f6257b743b2b3b8f47506121fe05e31f2 Mon Sep 17 00:00:00 2001 From: "mati108@gmail.com" <34651529+matbenitez@users.noreply.github.com> Date: Sat, 17 Nov 2018 13:50:29 -0300 Subject: [PATCH] Changing execution order --- Run.js | 62 +++++++++++++++++++++++++++------------------------------- 1 file changed, 29 insertions(+), 33 deletions(-) diff --git a/Run.js b/Run.js index fc86c4bcd..980a4d657 100644 --- a/Run.js +++ b/Run.js @@ -34,13 +34,37 @@ process.on('exit', function (code) { } }); -global.USER_PROFILE = {}; -global.EMAIL_CONFIG = {}; +readExecutionConfiguration(); -readStoragePermissions(); +function readExecutionConfiguration() { + let filePath; + try { + let fs = require('fs'); + + 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.EXCHANGE_NAME = executionProperties.exchangeName; + global.MARKET = executionProperties.market; + global.EXECUTION_CONFIG = { + executionList: executionProperties.executionList, + startMode: executionProperties.startMode + }; + + readStoragePermissions(); + } + catch (err) { + console.log("[ERROR] readExecutionConfiguration -> err = " + err.message); + console.log("[HINT] You need to have a file at this path -> " + filePath); + } +} function readStoragePermissions() { - let filePath; try { @@ -112,7 +136,7 @@ function readEmailConfiguration() { filePath = './' + 'configs' + '/' + 'Email.Config.json'; global.EMAIL_CONFIG = JSON.parse(fs.readFileSync(filePath, 'utf8')); - readExecutionConfiguration(); + startRoot(); } catch (err) { console.log("[ERROR] Run -> readEmailConfiguration -> err = " + err.message); @@ -120,34 +144,6 @@ function readEmailConfiguration() { } } -function readExecutionConfiguration() { - let filePath; - try { - let fs = require('fs'); - - 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.EXCHANGE_NAME = executionProperties.exchangeName; - global.MARKET = executionProperties.market; - global.EXECUTION_CONFIG = { - executionList: executionProperties.executionList, - startMode: executionProperties.startMode - }; - - startRoot(); - } - catch (err) { - console.log("[ERROR] readExecutionConfiguration -> err = " + err.message); - console.log("[HINT] You need to have a file at this path -> " + filePath); - } -} - function startRoot() { console.log( "[INFO] Run -> startRoot -> Entering function. ");