From 4953854017128e309589e830fc7c026cc6291a7c Mon Sep 17 00:00:00 2001 From: Leon Fedotov Date: Fri, 6 Oct 2017 01:16:24 +0300 Subject: [PATCH] Sandbox migration (#465) * adding sandbox change migration * adding winston slack logger * v2.10.1 --- libs/logger.js | 14 ++++- migrations/20171006005624_sandbox2017.js | 15 +++++ package.json | 5 +- yarn.lock | 74 ++++++++++-------------- 4 files changed, 58 insertions(+), 50 deletions(-) create mode 100644 migrations/20171006005624_sandbox2017.js diff --git a/libs/logger.js b/libs/logger.js index 8af6a3955..919ef7cc4 100644 --- a/libs/logger.js +++ b/libs/logger.js @@ -1,8 +1,9 @@ const path = require('path'); const winston = require('winston'); const assert = require('assert'); -const sprintf = require("sprintf-js").sprintf; +const sprintf = require('sprintf-js').sprintf; const dateFormat = require('dateformat'); +const Slack = require('winston-slack-transport'); module.exports = function (module) { assert(module); @@ -13,13 +14,20 @@ module.exports = function (module) { var logger = new winston.Logger({ transports: [ + new Slack({ + webhook_url: 'https://hooks.slack.com/services/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', + channel: '#devops-log', + username: 'ErrorBot', + level: 'info', + handleExceptions: true + }), new (winston.transports.Console)({ timestamp: function () { - return dateFormat(Date.now(), "dd/mm/yy hh:MM:ss.l"); + return dateFormat(Date.now(), 'dd/mm/yy hh:MM:ss.l'); }, formatter: function (options) { // Return string will be passed to logger. - return sprintf("%-33s", options.timestamp() + ' ' + options.level.toUpperCase() + ' ' + id + ' : ') + (options.message ? options.message : '') + + return sprintf('%-33s', options.timestamp() + ' ' + options.level.toUpperCase() + ' ' + id + ' : ') + (options.message ? options.message : '') + (options.meta && Object.keys(options.meta).length ? '\n\t' + JSON.stringify(options.meta) : ''); } }) diff --git a/migrations/20171006005624_sandbox2017.js b/migrations/20171006005624_sandbox2017.js new file mode 100644 index 000000000..d372d1b2a --- /dev/null +++ b/migrations/20171006005624_sandbox2017.js @@ -0,0 +1,15 @@ + +exports.down = function(knex, Promise) { + +}; + +exports.up = function (knex, Promise) { + return Promise.all([ + knex('events').insert({ + event_id: "SANDBOX2017", + gate_code: "171819", + name: "Sandbox 2017 ארגז חול", + gate_status: "early_arrival" + }) + ]); +}; \ No newline at end of file diff --git a/package.json b/package.json index 4a2c19fd2..e0b8913e7 100644 --- a/package.json +++ b/package.json @@ -5,7 +5,7 @@ "this is part of the deployment proess, so it is important to update the version number", "version name corresponds to the github release name / tag name - https://github.com/Midburn/Spark/releases" ], - "version": "2.10.0", + "version": "2.10.1", "private": true, "scripts": { "postinstall": "bower install", @@ -87,12 +87,13 @@ "request": "^2.74.0", "requirejs": "^2.3.2", "serve-favicon": "~2.4.3", + "snyk": "^1.34.4", "sprintf-js": "1.0.3", "sqlite3": "^3.1.8", "superagent": "^3.5.0", "webpack": "^1.14.0", "winston": "2.3.0", - "snyk": "^1.34.4", + "winston-slack-transport": "^2.0.0", "xml2js-parser": "^1.1.1" }, "devDependencies": { diff --git a/yarn.lock b/yarn.lock index b0d36dc2d..b6d177062 100644 --- a/yarn.lock +++ b/yarn.lock @@ -1166,13 +1166,13 @@ debug@2.6.1: dependencies: ms "0.7.2" -debug@2.6.9, debug@^2.1.2: +debug@2.6.9, debug@^2.1.2, debug@^2.1.3, debug@^2.2.0: version "2.6.9" resolved "https://registry.yarnpkg.com/debug/-/debug-2.6.9.tgz#5d128515df134ff327e90a4c93f4e077a536341f" dependencies: ms "2.0.0" -debug@^2.1.1, debug@^2.1.3, debug@^2.2.0, debug@~2.6.7: +debug@^2.1.1, debug@~2.6.7: version "2.6.8" resolved "https://registry.yarnpkg.com/debug/-/debug-2.6.8.tgz#e731531ca2ede27d188222427da17821d68ff4fc" dependencies: @@ -1220,14 +1220,10 @@ delegates@^1.0.0: version "1.0.0" resolved "https://registry.yarnpkg.com/delegates/-/delegates-1.0.0.tgz#84c6e159b81904fdca59a0ef44cd870d31250f9a" -depd@1.1.1, depd@~1.1.1: +depd@1.1.1, depd@~1.1.0, depd@~1.1.1: version "1.1.1" resolved "https://registry.yarnpkg.com/depd/-/depd-1.1.1.tgz#5783b4e1c459f06fa5ca27f991f3d06e7a310359" -depd@~1.1.0: - version "1.1.0" - resolved "https://registry.yarnpkg.com/depd/-/depd-1.1.0.tgz#e1bd82c6aab6ced965b97b88b17ed3e528ca18c3" - destroy@~1.0.4: version "1.0.4" resolved "https://registry.yarnpkg.com/destroy/-/destroy-1.0.4.tgz#978857442c44749e4206613e37946205826abd80" @@ -1525,11 +1521,7 @@ esutils@^2.0.0, esutils@^2.0.2: version "2.0.2" resolved "https://registry.yarnpkg.com/esutils/-/esutils-2.0.2.tgz#0abf4f1caa5bcb1f7a9d8acc6dea4faaa04bac9b" -etag@~1.8.0: - version "1.8.0" - resolved "https://registry.yarnpkg.com/etag/-/etag-1.8.0.tgz#6f631aef336d6c46362b51764044ce216be3c051" - -etag@~1.8.1: +etag@~1.8.0, etag@~1.8.1: version "1.8.1" resolved "https://registry.yarnpkg.com/etag/-/etag-1.8.1.tgz#41ae2eeb65efa62268aebfea83ac7d79299b0887" @@ -2191,14 +2183,10 @@ i18next@^8.2.1: version "8.2.1" resolved "https://registry.yarnpkg.com/i18next/-/i18next-8.2.1.tgz#6d2e8884516c320b4020c5af63e0316be626ac95" -iconv-lite@0.4.19, iconv-lite@^0.4.4: +iconv-lite@0.4.19, iconv-lite@^0.4.4, iconv-lite@~0.4.13: version "0.4.19" resolved "https://registry.yarnpkg.com/iconv-lite/-/iconv-lite-0.4.19.tgz#f7468f60135f5e5dad3399c0a81be9a1603a082b" -iconv-lite@~0.4.13: - version "0.4.15" - resolved "https://registry.yarnpkg.com/iconv-lite/-/iconv-lite-0.4.15.tgz#fe265a218ac6a57cfe854927e9d04c19825eddeb" - ieee754@^1.1.4: version "1.1.8" resolved "https://registry.yarnpkg.com/ieee754/-/ieee754-1.1.8.tgz#be33d40ac10ef1926701f6f08a2d86fbfd1ad3e4" @@ -2680,13 +2668,7 @@ kind-of@^2.0.1: dependencies: is-buffer "^1.0.2" -kind-of@^3.0.2: - version "3.1.0" - resolved "https://registry.yarnpkg.com/kind-of/-/kind-of-3.1.0.tgz#475d698a5e49ff5e53d14e3e732429dc8bf4cf47" - dependencies: - is-buffer "^1.0.2" - -kind-of@^3.2.2: +kind-of@^3.0.2, kind-of@^3.2.2: version "3.2.2" resolved "https://registry.yarnpkg.com/kind-of/-/kind-of-3.2.2.tgz#31ea21a734bab9bbb0f32466d893aea51e4a3c64" dependencies: @@ -2998,23 +2980,23 @@ mime-db@~1.30.0: version "1.30.0" resolved "https://registry.yarnpkg.com/mime-db/-/mime-db-1.30.0.tgz#74c643da2dd9d6a45399963465b26d5ca7d71f01" -mime-types@^2.1.10, mime-types@^2.1.12, mime-types@~2.1.11, mime-types@~2.1.7: - version "2.1.14" - resolved "https://registry.yarnpkg.com/mime-types/-/mime-types-2.1.14.tgz#f7ef7d97583fcaf3b7d282b6f8b5679dab1e94ee" +mime-types@^2.1.10, mime-types@^2.1.12, mime-types@~2.1.16: + version "2.1.17" + resolved "https://registry.yarnpkg.com/mime-types/-/mime-types-2.1.17.tgz#09d7a393f03e995a79f8af857b70a9e0ab16557a" dependencies: - mime-db "~1.26.0" + mime-db "~1.30.0" -mime-types@~2.1.15: +mime-types@~2.1.11, mime-types@~2.1.15: version "2.1.15" resolved "https://registry.yarnpkg.com/mime-types/-/mime-types-2.1.15.tgz#a4ebf5064094569237b8cf70046776d09fc92aed" dependencies: mime-db "~1.27.0" -mime-types@~2.1.16: - version "2.1.17" - resolved "https://registry.yarnpkg.com/mime-types/-/mime-types-2.1.17.tgz#09d7a393f03e995a79f8af857b70a9e0ab16557a" +mime-types@~2.1.7: + version "2.1.14" + resolved "https://registry.yarnpkg.com/mime-types/-/mime-types-2.1.14.tgz#f7ef7d97583fcaf3b7d282b6f8b5679dab1e94ee" dependencies: - mime-db "~1.30.0" + mime-db "~1.26.0" mime@1.4.1: version "1.4.1" @@ -3502,11 +3484,7 @@ parse-passwd@^1.0.0: version "1.0.0" resolved "https://registry.yarnpkg.com/parse-passwd/-/parse-passwd-1.0.0.tgz#6d5b934a456993b23d37f40a382d6f1666a8e5c6" -parseurl@~1.3.1: - version "1.3.1" - resolved "https://registry.yarnpkg.com/parseurl/-/parseurl-1.3.1.tgz#c8ab8c9223ba34888aa64a297b28853bec18da56" - -parseurl@~1.3.2: +parseurl@~1.3.1, parseurl@~1.3.2: version "1.3.2" resolved "https://registry.yarnpkg.com/parseurl/-/parseurl-1.3.2.tgz#fc289d4ed8993119460c156253262cdc8de65bf3" @@ -3728,11 +3706,11 @@ punycode@~1.2.4: version "1.2.4" resolved "https://registry.yarnpkg.com/punycode/-/punycode-1.2.4.tgz#54008ac972aec74175def9cba6df7fa9d3918740" -qs@6.5.1: +qs@6.5.1, qs@^6.0.2, qs@^6.1.0: version "6.5.1" resolved "https://registry.yarnpkg.com/qs/-/qs-6.5.1.tgz#349cdf6eef89ec45c12d7d5eb3fc0c870343a6d8" -qs@^6.0.2, qs@^6.1.0, qs@~6.4.0: +qs@~6.4.0: version "6.4.0" resolved "https://registry.yarnpkg.com/qs/-/qs-6.4.0.tgz#13e26d28ad6b0ffaa91312cd3bf708ed351e7233" @@ -3930,7 +3908,7 @@ repeating@^2.0.0: dependencies: is-finite "^1.0.0" -request@2, request@^2.61.0, request@^2.74.0, request@^2.79.0: +request@2, request@^2.61.0, request@^2.67.0, request@^2.74.0, request@^2.79.0: version "2.81.0" resolved "https://registry.yarnpkg.com/request/-/request-2.81.0.tgz#c6928946a0e06c5f8d6f8a9333469ffda46298a0" dependencies: @@ -4046,11 +4024,11 @@ rx@^4.1.0: version "4.1.0" resolved "https://registry.yarnpkg.com/rx/-/rx-4.1.0.tgz#a5f13ff79ef3b740fe30aa803fb09f98805d4782" -safe-buffer@5.0.1, safe-buffer@^5.0.1: +safe-buffer@5.0.1: version "5.0.1" resolved "https://registry.yarnpkg.com/safe-buffer/-/safe-buffer-5.0.1.tgz#d263ca54696cd8a306b5ca6551e92de57918fbe7" -safe-buffer@5.1.1: +safe-buffer@5.1.1, safe-buffer@^5.0.1: version "5.1.1" resolved "https://registry.yarnpkg.com/safe-buffer/-/safe-buffer-5.1.1.tgz#893312af69b2123def71f57889001671eeb2c853" @@ -4842,11 +4820,11 @@ util@0.10.3, util@^0.10.3: dependencies: inherits "2.0.1" -utils-merge@1.0.0, utils-merge@1.x.x: +utils-merge@1.0.0: version "1.0.0" resolved "https://registry.yarnpkg.com/utils-merge/-/utils-merge-1.0.0.tgz#0294fb922bb9375153541c4f7096231f287c8af8" -utils-merge@1.0.1: +utils-merge@1.0.1, utils-merge@1.x.x: version "1.0.1" resolved "https://registry.yarnpkg.com/utils-merge/-/utils-merge-1.0.1.tgz#9f95710f50a267947b2ccc124741c1028427e713" @@ -4978,6 +4956,12 @@ window-size@^0.2.0: version "0.2.0" resolved "https://registry.yarnpkg.com/window-size/-/window-size-0.2.0.tgz#b4315bb4214a3d7058ebeee892e13fa24d98b075" +winston-slack-transport@^2.0.0: + version "2.0.0" + resolved "https://registry.yarnpkg.com/winston-slack-transport/-/winston-slack-transport-2.0.0.tgz#85693c85be4fe9473d48abd6196acb7e58e065a5" + dependencies: + request "^2.67.0" + winston@2.3.0: version "2.3.0" resolved "https://registry.yarnpkg.com/winston/-/winston-2.3.0.tgz#207faaab6fccf3fe493743dd2b03dbafc7ceb78c"