This commit is contained in:
Kristian Polso 2018-05-30 12:50:19 +03:00
parent 5583ecbe7e
commit 54484e5b0c
3 changed files with 53 additions and 5 deletions

View file

@ -19,6 +19,7 @@
"cron": "^1.3.0",
"dotenv": "^5.0.1",
"express": "^4.16.3",
"heroku-logger": "^0.3.1",
"heroku-ssl-redirect": "0.0.4",
"highlight.js": "^9.12.0",
"node-sass": "^4.9.0",

View file

@ -18,6 +18,8 @@ var octokit = require('@octokit/rest')();
// Redis
var redis = require("redis"),
redisClient = redis.createClient(process.env.REDISCLOUD_URL);
// Logging
var logger = require('heroku-logger');
app = express();
app.use(serveStatic(__dirname + "/.vuepress/dist"));
@ -58,6 +60,9 @@ app.get('/forward', function(req, res) {
qs: req.query
}, function(error, response, body) {
// Should we parse the body before forwarding?
if(typeof body.error != "") {
logger.error('Got error from daemon', body);
}
res.setHeader('Content-Type', 'application/json');
res.send(body);
});
@ -87,7 +92,7 @@ app.get('/github-feed', function(req, res) {
var port = process.env.PORT || 8080;
app.listen(port);
console.log('server started '+ port);
logger.info('server started', {port: port});
function updateGithubFeed() {
@ -120,10 +125,14 @@ function updateGithubFeed() {
// Keep the latest 50 events
redisClient.zremrangebyrank('events', 0, -51);
console.log('Updated Github feed');
logger.info('Updated Github feed');
});
}).catch(function({data}) {
logger.error('Couldn\t update Github feed', data);
});
}

View file

@ -2086,6 +2086,10 @@ des.js@^1.0.0:
inherits "^2.0.1"
minimalistic-assert "^1.0.0"
destroy-circular@^1.1.0:
version "1.1.0"
resolved "https://registry.yarnpkg.com/destroy-circular/-/destroy-circular-1.1.0.tgz#f76624b76f999f1ac18b0ab444495118293a3ce0"
destroy@^1.0.3, destroy@~1.0.4:
version "1.0.4"
resolved "https://registry.yarnpkg.com/destroy/-/destroy-1.0.4.tgz#978857442c44749e4206613e37946205826abd80"
@ -2556,6 +2560,12 @@ find-up@^2.0.0, find-up@^2.1.0:
dependencies:
locate-path "^2.0.0"
flat@^2.0.1:
version "2.0.1"
resolved "https://registry.yarnpkg.com/flat/-/flat-2.0.1.tgz#70e29188a74be0c3c89409eed1fa9577907ae32f"
dependencies:
is-buffer "~1.1.2"
flatten@^1.0.2:
version "1.0.2"
resolved "https://registry.yarnpkg.com/flatten/-/flatten-1.0.2.tgz#dae46a9d78fbe25292258cc1e780a41d95c03782"
@ -3018,6 +3028,16 @@ he@1.1.x, he@^1.1.0:
version "1.1.1"
resolved "https://registry.yarnpkg.com/he/-/he-1.1.1.tgz#93410fd21b009735151f8868c2f271f3427e23fd"
heroku-logger@^0.3.1:
version "0.3.1"
resolved "https://registry.yarnpkg.com/heroku-logger/-/heroku-logger-0.3.1.tgz#6ac749cd7779e7f903c481c50882e511cfed5849"
dependencies:
chalk "^1.1.3"
destroy-circular "^1.1.0"
flat "^2.0.1"
is "^3.2.1"
logfmt "^1.2.0"
heroku-ssl-redirect@0.0.4:
version "0.0.4"
resolved "https://registry.yarnpkg.com/heroku-ssl-redirect/-/heroku-ssl-redirect-0.0.4.tgz#21ba0707aa503b50a412a0946abfaa88ef7d082c"
@ -3287,7 +3307,7 @@ is-binary-path@^1.0.0:
dependencies:
binary-extensions "^1.0.0"
is-buffer@^1.1.5:
is-buffer@^1.1.5, is-buffer@~1.1.2:
version "1.1.6"
resolved "https://registry.yarnpkg.com/is-buffer/-/is-buffer-1.1.6.tgz#efaa2ea9daa0d7ab2ea13a97b2b8ad51fefbe8be"
@ -3506,6 +3526,10 @@ is-wsl@^1.1.0:
version "1.1.0"
resolved "https://registry.yarnpkg.com/is-wsl/-/is-wsl-1.1.0.tgz#1f16e4aa22b04d1336b66188a66af3c600c3a66d"
is@^3.2.1:
version "3.2.1"
resolved "https://registry.yarnpkg.com/is/-/is-3.2.1.tgz#d0ac2ad55eb7b0bec926a5266f6c662aaa83dca5"
isarray@0.0.1:
version "0.0.1"
resolved "https://registry.yarnpkg.com/isarray/-/isarray-0.0.1.tgz#8a18acfca9a8f4177e09abfc6038939b05d1eedf"
@ -3898,7 +3922,7 @@ lodash.uniq@^4.5.0:
version "4.5.0"
resolved "https://registry.yarnpkg.com/lodash.uniq/-/lodash.uniq-4.5.0.tgz#d0225373aeb652adc1bc82e4945339a842754773"
lodash@^4.0.0, lodash@^4.14.0, lodash@~4.17.4:
lodash@4.x, lodash@^4.0.0, lodash@^4.14.0, lodash@~4.17.4:
version "4.17.10"
resolved "https://registry.yarnpkg.com/lodash/-/lodash-4.17.10.tgz#1b7793cf7259ea38fb3661d4d38b3260af8ae4e7"
@ -3920,6 +3944,14 @@ log-update@^2.3.0:
cli-cursor "^2.0.0"
wrap-ansi "^3.0.1"
logfmt@^1.2.0:
version "1.2.1"
resolved "https://registry.yarnpkg.com/logfmt/-/logfmt-1.2.1.tgz#0e99838eb3a87fb6272d6d2b4fc327b95a29abee"
dependencies:
lodash "4.x"
split "0.2.x"
through "2.3.x"
loglevelnext@^1.0.1, loglevelnext@^1.0.2:
version "1.0.4"
resolved "https://registry.yarnpkg.com/loglevelnext/-/loglevelnext-1.0.4.tgz#0d991d9998180991dac8bd81e73a596a8720a645"
@ -5983,6 +6015,12 @@ split-string@^3.0.1, split-string@^3.0.2:
dependencies:
extend-shallow "^3.0.0"
split@0.2.x:
version "0.2.10"
resolved "https://registry.yarnpkg.com/split/-/split-0.2.10.tgz#67097c601d697ce1368f418f06cd201cf0521a57"
dependencies:
through "2"
sprintf-js@~1.0.2:
version "1.0.3"
resolved "https://registry.yarnpkg.com/sprintf-js/-/sprintf-js-1.0.3.tgz#04e6926f662895354f3dd015203633b857297e2c"
@ -6251,7 +6289,7 @@ through2@^2.0.0:
readable-stream "^2.1.5"
xtend "~4.0.1"
through@~2.3.4:
through@2, through@2.3.x, through@~2.3.4:
version "2.3.8"
resolved "https://registry.yarnpkg.com/through/-/through-2.3.8.tgz#0dd4c9ffaabc357960b1b724115d7e0e86a2e1f5"