diff --git a/.dockerignore b/.dockerignore new file mode 100644 index 000000000..0165f51d2 --- /dev/null +++ b/.dockerignore @@ -0,0 +1,14 @@ +.vs/** +obj/** + +bin/** + +*.config +*.log +*.cache +.env* + +\.vscode/ +Project.njsproj +coverage/ +.nyc_output/ diff --git a/Dockerfile b/Dockerfile index 860816832..356128e9b 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,4 +1,4 @@ -FROM node:8.6-alpine +FROM node:8.16-alpine RUN mkdir -p /usr/src/app WORKDIR /usr/src/app diff --git a/Integrations/FileStorage.js b/Integrations/FileStorage.js index c8507ccae..b7cd67f63 100644 --- a/Integrations/FileStorage.js +++ b/Integrations/FileStorage.js @@ -13,7 +13,7 @@ exports.newFileStorage = function newFileStorage() { function getTextFile(container, filePath, callBackFunction) { try { - if (INFO_LOG === true) { console.log('[INFO] getTextFile -> getBlobToText -> Entering function: ' + filePath) } + if (INFO_LOG === true) { console.log('[INFO] getTextFile -> Entering function: ' + filePath) } axios({ url: process.env.HOST_URL + 'graphql', @@ -47,20 +47,20 @@ exports.newFileStorage = function newFileStorage() { else callBackFunction(global.CUSTOM_FAIL_RESPONSE) }).catch(error => { - if (ERROR_LOG === true) { console.log('newFileStorage: [ERROR] getTextFile -> getBlobToText -> Invalid JSON received. ') } - if (ERROR_LOG === true) { console.log('newFileStorage: [ERROR] getTextFile -> getBlobToText -> response.text = ' + error.message) } + if (ERROR_LOG === true) { console.log('newFileStorage: [ERROR] getTextFile -> Invalid JSON received. ') } + if (ERROR_LOG === true) { console.log('newFileStorage: [ERROR] getTextFile -> response.text = ' + error.message) } callBackFunction(global.DEFAULT_FAIL_RESPONSE) }) } catch (err) { - if (ERROR_LOG === true) { console.log('[ERROR] getTextFile -> getBlobToText -> err = ' + err.stack) } + if (ERROR_LOG === true) { console.log('[ERROR] getTextFile -> err = ' + err.stack) } } } - function createTextFile(container, filePath, fileContent, callBackFunction) { + async function createTextFile(container, filePath, fileContent, callBackFunction) { try { - if (INFO_LOG === true) { console.log('[INFO] getTextFile -> createTextFile -> Entering function: ' + filePath) } + if (INFO_LOG === true) { console.log('[INFO] createTextFile -> Entering function: ' + filePath) } - axios({ + let response = await axios({ url: process.env.HOST_URL + 'graphql', method: 'post', data: { @@ -79,26 +79,32 @@ exports.newFileStorage = function newFileStorage() { } } } - }).then(res => { - if (res.data.errors) { - let error = { - code: res.data.errors[0] - } - callBackFunction(error) - return - } - let response = res.data.data.web_CreateFile - if (response) - callBackFunction(global.DEFAULT_OK_RESPONSE) - else - callBackFunction(global.CUSTOM_FAIL_RESPONSE) - }).catch(error => { - if (ERROR_LOG === true) { console.log('newFileStorage: [ERROR] getTextFile -> getBlobToText -> Invalid JSON received. ') } - if (ERROR_LOG === true) { console.log('newFileStorage: [ERROR] getTextFile -> getBlobToText -> response.text = ' + error.message) } - callBackFunction(global.DEFAULT_FAIL_RESPONSE) }) + + if(!response){ + console.log('[ERROR] createTextFile -> err = ') + } + + // .then(res => { + // if (res.data.errors) { + // let error = { + // code: res.data.errors[0] + // } + // callBackFunction(error) + // return + // } + // let response = res.data.data.web_CreateFile + // if (response) + // callBackFunction(global.DEFAULT_OK_RESPONSE) + // else + // callBackFunction(global.CUSTOM_FAIL_RESPONSE) + // }).catch(error => { + // if (ERROR_LOG === true) { console.log('newFileStorage: [ERROR] createTextFile -> Invalid JSON received. ') } + // if (ERROR_LOG === true) { console.log('newFileStorage: [ERROR] createTextFile -> response.text = ' + error.message) } + // callBackFunction(global.DEFAULT_FAIL_RESPONSE) + // }) } catch (err) { - if (ERROR_LOG === true) { console.log('[ERROR] createTextFile -> getBlobToText -> err = ' + err.stack) } + if (ERROR_LOG === true) { console.log('[ERROR] createTextFile -> err = ' + err.stack) } } } diff --git a/Integrations/Strategy.js b/Integrations/Strategy.js index 585c5aec8..3ccdc5967 100644 --- a/Integrations/Strategy.js +++ b/Integrations/Strategy.js @@ -19,18 +19,18 @@ exports.getStrategy = async function () { method: 'post', data: { query: ` - query($fbSlug: String!){ - strategizer_TradingSystemByFb(fbSlug: $fbSlug){ - data + query($fbSlug: String!){ + strategizer_TradingSystemByFb(fbSlug: $fbSlug){ + data + } } - } - `, + `, variables: { fbSlug: fbSlug }, }, headers: { - access_token: process.env.ACCESS_TOKEN + access_token: process.env.ACCESS_TOKEN_STRATEGY } }) diff --git a/Root.js b/Root.js index a159898d4..f8e36433a 100644 --- a/Root.js +++ b/Root.js @@ -607,7 +607,6 @@ logger.write(MODULE_NAME, "[ERROR] start -> findProcess -> runIndicatorBot -> onInitializeReady -> Failed to initialize the bot. "); console.log(logDisplace + "Root : [ERROR] start -> findProcess -> runIndicatorBot -> onInitializeReady -> err = " + err.message); logger.persist(); - throw new Error("Root -> start -> findProcess -> runIndicatorBot -> onInitializeReady -> Failed to initialize the bot.") } } } diff --git a/docker-compose.prod.yml b/docker-compose.yml similarity index 100% rename from docker-compose.prod.yml rename to docker-compose.yml diff --git a/package-lock.json b/package-lock.json index 93b9e56c3..2979492fb 100644 --- a/package-lock.json +++ b/package-lock.json @@ -18,6 +18,17 @@ "retry": "^0.12.0", "superagent": "^5.0.2", "underscore": "^1.9.1" + }, + "dependencies": { + "axios": { + "version": "0.19.0", + "resolved": "https://registry.npmjs.org/axios/-/axios-0.19.0.tgz", + "integrity": "sha512-1uvKqKQta3KBxIz14F2v06AEHZ/dIoeKfbTRkK1E5oqjDnuEerLmYTgJB5AiQZHJcljpg1TuRzdjDR06qNk0DQ==", + "requires": { + "follow-redirects": "1.5.10", + "is-buffer": "^2.0.2" + } + } } }, "@superalgos/mqservice": {