fix backend.

This commit is contained in:
Nawaz Dhandala 2021-06-24 21:33:37 +01:00
parent 1edf958270
commit 47ff64df9e
7 changed files with 27 additions and 105 deletions

View File

@ -24,4 +24,7 @@ INTERNAL_SMTP_FROM=support@fyipe.com
INTERNAL_SMTP_NAME=support
FYIPE_HOST=localhost:3002
BACKEND_PROTOCOL=http
SCRIPT_RUNNER_URL=http://localhost:3009
SCRIPT_RUNNER_URL=http://localhost:3009
SLACK_ERROR_LOG_WEBHOOK=https://hooks.slack.com/services/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
SLACK_ERROR_LOG_CHANNEL=fyipe-logs
PORT=3002

1
backend/.gitignore vendored
View File

@ -24,6 +24,5 @@ apiTest.rest
application_security_dir
container_security_dir
/greenlock.d
/greenlock.d/config.json
/greenlock.d/config.json.bak

View File

@ -1,17 +1,12 @@
const winston = require('winston');
const Slack = require('winston-slack-transport');
const Slack = require('winston-slack-webhook-transport');
if (
process.env.PORT &&
process.env.SLACK_ERROR_LOG_WEBHOOK &&
process.env.SLACK_ERROR_LOG_CHANNEL
) {
winston.add(Slack, {
webhook_url: process.env.SLACK_ERROR_LOG_WEBHOOK,
channel: '#' + process.env.SLACK_ERROR_LOG_CHANNEL,
username: 'Error Bot',
handleExceptions: true,
});
winston.add(new Slack({ webhookUrl: process.env.SLACK_ERROR_LOG_WEBHOOK }));
}
module.exports = {

View File

@ -47,6 +47,7 @@
"express-rate-limit": "^5.2.6",
"crypto-js": "^4.0.0",
"request": "^2.88.2",
"winston-slack-webhook-transport": "^2.0.1",
"cross-env": "^7.0.3",
"rate-limit-redis": "^2.1.0",
"psl": "^1.8.0",
@ -61,7 +62,6 @@
"async-mutex": "^0.3.1",
"socket.io": "^4.1.2",
"stripe": "^8.156.0",
"winston-slack-transport": "^2.0.0",
"express": "^4.17.1",
"cors": "^2.8.4",
"multer": "^1.4.2",
@ -1233,17 +1233,6 @@
"node": ">=0.10.0"
}
},
"node_modules/winston-slack-transport": {
"version": "2.0.0",
"resolved": "https://registry.npmjs.org/winston-slack-transport/-/winston-slack-transport-2.0.0.tgz",
"integrity": "sha1-hWk8hb5P6Uc9SKvWGWrLfljgZaU=",
"dependencies": {
"request": "^2.67.0"
},
"engines": {
"node": ">= 0.6.0"
}
},
"node_modules/decode-uri-component": {
"version": "0.2.0",
"resolved": "https://registry.npmjs.org/decode-uri-component/-/decode-uri-component-0.2.0.tgz",
@ -2668,15 +2657,6 @@
"resolved": "https://registry.npmjs.org/aproba/-/aproba-1.2.0.tgz",
"integrity": "sha512-Y9J6ZjXtoYh8RnXVCMOU/ttDmk1aBjunq9vO0ta5x85WDQiQfUF9sIPBITdbiiIVcBo03Hi3jMxigBtsddlXRw=="
},
"node_modules/cliui/node_modules/is-fullwidth-code-point": {
"version": "3.0.0",
"resolved": "https://registry.npmjs.org/is-fullwidth-code-point/-/is-fullwidth-code-point-3.0.0.tgz",
"integrity": "sha512-zymm5+u+sCsSWyD9qNaejV3DFvhCKclKdizYaJUuHA83RLjb7nSuGnddCHGv0hk+KY7BMAlsWeK4Ueg6EV6XQg==",
"dev": true,
"engines": {
"node": ">=8"
}
},
"node_modules/@vue/compiler-ssr": {
"version": "3.1.2",
"resolved": "https://registry.npmjs.org/@vue/compiler-ssr/-/compiler-ssr-3.1.2.tgz",
@ -4213,12 +4193,6 @@
"node": ">=8"
}
},
"node_modules/mocha/node_modules/argparse": {
"version": "2.0.1",
"resolved": "https://registry.npmjs.org/argparse/-/argparse-2.0.1.tgz",
"integrity": "sha512-8+9WqebbFzpX9OR+Wa6O29asIogeRMzcGtAINdpMHHyAg10f05aSFVBbcEqGf/PXw1EjAZ+q2/bEBg3DvurK3Q==",
"dev": true
},
"node_modules/log-symbols/node_modules/chalk": {
"version": "4.1.1",
"resolved": "https://registry.npmjs.org/chalk/-/chalk-4.1.1.tgz",
@ -4531,18 +4505,6 @@
"@root/x509": "^0.7.2"
}
},
"node_modules/wrap-ansi/node_modules/color-convert": {
"version": "2.0.1",
"resolved": "https://registry.npmjs.org/color-convert/-/color-convert-2.0.1.tgz",
"integrity": "sha512-RRECPsj7iu/xb5oKYcsFHSppFNnsj/52OVTRKb4zP5onXwVF3zVmmToNcOfGC+CRDpfK/U584fMg38ZHCaElKQ==",
"dev": true,
"dependencies": {
"color-name": "~1.1.4"
},
"engines": {
"node": ">=7.0.0"
}
},
"node_modules/simple-swizzle/node_modules/is-arrayish": {
"version": "0.3.2",
"resolved": "https://registry.npmjs.org/is-arrayish/-/is-arrayish-0.3.2.tgz",
@ -4991,15 +4953,6 @@
"node": ">=6"
}
},
"node_modules/wrap-ansi/node_modules/is-fullwidth-code-point": {
"version": "3.0.0",
"resolved": "https://registry.npmjs.org/is-fullwidth-code-point/-/is-fullwidth-code-point-3.0.0.tgz",
"integrity": "sha512-zymm5+u+sCsSWyD9qNaejV3DFvhCKclKdizYaJUuHA83RLjb7nSuGnddCHGv0hk+KY7BMAlsWeK4Ueg6EV6XQg==",
"dev": true,
"engines": {
"node": ">=8"
}
},
"node_modules/typedarray-to-buffer": {
"version": "3.1.5",
"resolved": "https://registry.npmjs.org/typedarray-to-buffer/-/typedarray-to-buffer-3.1.5.tgz",
@ -5052,12 +5005,6 @@
"node": ">=0.4.0"
}
},
"node_modules/wrap-ansi/node_modules/color-name": {
"version": "1.1.4",
"resolved": "https://registry.npmjs.org/color-name/-/color-name-1.1.4.tgz",
"integrity": "sha512-dOy+3AuW3a2wNbZHIuMZpTcgjGuLU/uBL/ubcZF9OXbDo8ff4O8yVp5Bf0efS8uEoYo5q4Fx7dY9OgQGXgAsQA==",
"dev": true
},
"node_modules/normalize-url": {
"version": "4.5.0",
"resolved": "https://registry.npmjs.org/normalize-url/-/normalize-url-4.5.0.tgz",
@ -6681,6 +6628,15 @@
"node": ">= 0.6"
}
},
"node_modules/winston-slack-webhook-transport": {
"version": "2.0.1",
"resolved": "https://registry.npmjs.org/winston-slack-webhook-transport/-/winston-slack-webhook-transport-2.0.1.tgz",
"integrity": "sha512-ux0XJPeeabwLJ4OP/0S8ZCC/5sGgSqyt735wHmVkR1I7NubxpI9i+/TP0e4zJ+CFgr596QQcxCccbVe+pmGzVQ==",
"dependencies": {
"axios": "^0.21.1",
"winston-transport": "^4.4.0"
}
},
"node_modules/socket.io-parser/node_modules/ms": {
"version": "2.1.2",
"resolved": "https://registry.npmjs.org/ms/-/ms-2.1.2.tgz",
@ -8948,12 +8904,6 @@
"integrity": "sha512-bY6fj56OUQ0hU1KjFNDQuJFezqKdrAyFdIevADiqrWHwSlbmBNMHp5ak2f40Pm8JTFyM2mqxkG6ngkHO11f/lg==",
"dev": true
},
"is-fullwidth-code-point": {
"version": "3.0.0",
"resolved": "https://registry.npmjs.org/is-fullwidth-code-point/-/is-fullwidth-code-point-3.0.0.tgz",
"integrity": "sha512-zymm5+u+sCsSWyD9qNaejV3DFvhCKclKdizYaJUuHA83RLjb7nSuGnddCHGv0hk+KY7BMAlsWeK4Ueg6EV6XQg==",
"dev": true
},
"string-width": {
"version": "4.2.2",
"resolved": "https://registry.npmjs.org/string-width/-/string-width-4.2.2.tgz",
@ -11136,12 +11086,6 @@
"yargs-unparser": "2.0.0"
},
"dependencies": {
"argparse": {
"version": "2.0.1",
"resolved": "https://registry.npmjs.org/argparse/-/argparse-2.0.1.tgz",
"integrity": "sha512-8+9WqebbFzpX9OR+Wa6O29asIogeRMzcGtAINdpMHHyAg10f05aSFVBbcEqGf/PXw1EjAZ+q2/bEBg3DvurK3Q==",
"dev": true
},
"debug": {
"version": "4.3.1",
"resolved": "https://registry.npmjs.org/debug/-/debug-4.3.1.tgz",
@ -13244,12 +13188,13 @@
}
}
},
"winston-slack-transport": {
"version": "2.0.0",
"resolved": "https://registry.npmjs.org/winston-slack-transport/-/winston-slack-transport-2.0.0.tgz",
"integrity": "sha1-hWk8hb5P6Uc9SKvWGWrLfljgZaU=",
"winston-slack-webhook-transport": {
"version": "2.0.1",
"resolved": "https://registry.npmjs.org/winston-slack-webhook-transport/-/winston-slack-webhook-transport-2.0.1.tgz",
"integrity": "sha512-ux0XJPeeabwLJ4OP/0S8ZCC/5sGgSqyt735wHmVkR1I7NubxpI9i+/TP0e4zJ+CFgr596QQcxCccbVe+pmGzVQ==",
"requires": {
"request": "^2.67.0"
"axios": "^0.21.1",
"winston-transport": "^4.4.0"
}
},
"winston-transport": {
@ -13303,27 +13248,6 @@
"color-convert": "^2.0.1"
}
},
"color-convert": {
"version": "2.0.1",
"resolved": "https://registry.npmjs.org/color-convert/-/color-convert-2.0.1.tgz",
"integrity": "sha512-RRECPsj7iu/xb5oKYcsFHSppFNnsj/52OVTRKb4zP5onXwVF3zVmmToNcOfGC+CRDpfK/U584fMg38ZHCaElKQ==",
"dev": true,
"requires": {
"color-name": "~1.1.4"
}
},
"color-name": {
"version": "1.1.4",
"resolved": "https://registry.npmjs.org/color-name/-/color-name-1.1.4.tgz",
"integrity": "sha512-dOy+3AuW3a2wNbZHIuMZpTcgjGuLU/uBL/ubcZF9OXbDo8ff4O8yVp5Bf0efS8uEoYo5q4Fx7dY9OgQGXgAsQA==",
"dev": true
},
"is-fullwidth-code-point": {
"version": "3.0.0",
"resolved": "https://registry.npmjs.org/is-fullwidth-code-point/-/is-fullwidth-code-point-3.0.0.tgz",
"integrity": "sha512-zymm5+u+sCsSWyD9qNaejV3DFvhCKclKdizYaJUuHA83RLjb7nSuGnddCHGv0hk+KY7BMAlsWeK4Ueg6EV6XQg==",
"dev": true
},
"string-width": {
"version": "4.2.2",
"resolved": "https://registry.npmjs.org/string-width/-/string-width-4.2.2.tgz",

View File

@ -61,7 +61,7 @@
"vm2": "^3.9.3",
"web-push": "^3.4.4",
"winston": "^3.3.3",
"winston-slack-transport": "^2.0.0"
"winston-slack-webhook-transport": "^2.0.1"
},
"scripts": {
"start": "node server.js",

View File

@ -80,6 +80,7 @@ services:
# Use node modules of the container and not host system.
# https://stackoverflow.com/questions/29181032/add-a-volume-to-docker-but-exclude-a-sub-folder
- /usr/src/app/node_modules/
- /usr/src/app/greenlock.d/
api-docs:
ports:

View File

@ -31,11 +31,11 @@
"fix-lint": "eslint '**/*.js' -c .eslintrc.json --ignore-path .eslintignore --fix",
"fix": "npm run fix-lint",
"build": "docker-compose build",
"build-dev": "docker-compose -f docker-compose.dev.yml build",
"build-dev": "docker-compose -f docker-compose.dev.yml build $npm_config_services",
"prod": "docker-compose up -d",
"dev": "npm run build-dev && npm run run-enterprise-dev",
"dev": "npm run build-dev $npm_config_services && npm run run-enterprise-dev $npm_config_services",
"saas-dev": "npm run build-dev && export IS_SAAS_SERVICE=true && npm run dev",
"run-enterprise-dev": "DOCKER_CLIENT_TIMEOUT=240 && COMPOSE_HTTP_TIMEOUT=240 && docker-compose -f docker-compose.dev.yml up -d",
"run-enterprise-dev": "DOCKER_CLIENT_TIMEOUT=240 && COMPOSE_HTTP_TIMEOUT=240 && docker-compose -f docker-compose.dev.yml up -d $npm_config_services",
"stop-dev": "docker-compose -f docker-compose.dev.yml down --remove-orphans",
"staging-test": "cd tests && npm run-script staging-test",
"remove-all-containers": "docker stop $(docker ps -a -q) && docker rm $(docker ps -a -q) || echo 'No running containers'",