From 07a7609502f84203f01b5f65b7521d4a2500acc0 Mon Sep 17 00:00:00 2001 From: Kristian Polso Date: Fri, 11 May 2018 23:08:44 +0300 Subject: [PATCH] Redis connection --- .gitignore | 4 +++- github.js | 7 +++++++ package.json | 2 ++ yarn.lock | 24 ++++++++++++++++++++++++ 4 files changed, 36 insertions(+), 1 deletion(-) diff --git a/.gitignore b/.gitignore index a666ce4..d63fe4e 100644 --- a/.gitignore +++ b/.gitignore @@ -13,4 +13,6 @@ yarn-error.log* *.njsproj *.sln -.vuepress/dist \ No newline at end of file +.vuepress/dist + +.env diff --git a/github.js b/github.js index e587092..b754a1d 100644 --- a/github.js +++ b/github.js @@ -1,5 +1,10 @@ +require('dotenv').config(); + var octokit = require('@octokit/rest')(); +var redis = require("redis"), +redisClient = redis.createClient(process.env.REDISCLOUD_URL); + octokit.activity.getEventsForOrg({ org: 'lbryio', per_page: 20, @@ -8,4 +13,6 @@ octokit.activity.getEventsForOrg({ console.log(data); + redisClient.set('events', JSON.stringify(data), redis.print); + }); \ No newline at end of file diff --git a/package.json b/package.json index 7c4093b..6fb9d1b 100644 --- a/package.json +++ b/package.json @@ -11,10 +11,12 @@ "dependencies": { "@octokit/rest": "^15.4.0", "cors": "^2.8.4", + "dotenv": "^5.0.1", "express": "^4.16.3", "heroku-ssl-redirect": "0.0.4", "highlight.js": "^9.12.0", "node-sass": "^4.8.3", + "redis": "^2.8.0", "request": "^2.85.0", "sass-loader": "^7.0.1", "vue": "^2.5.16", diff --git a/yarn.lock b/yarn.lock index 1765734..0d5389c 100644 --- a/yarn.lock +++ b/yarn.lock @@ -1473,6 +1473,14 @@ dot-prop@^4.1.0, dot-prop@^4.1.1: dependencies: is-obj "^1.0.0" +dotenv@^5.0.1: + version "5.0.1" + resolved "https://registry.yarnpkg.com/dotenv/-/dotenv-5.0.1.tgz#a5317459bd3d79ab88cff6e44057a6a3fbb1fcef" + +double-ended-queue@^2.1.0-0: + version "2.1.0-0" + resolved "https://registry.yarnpkg.com/double-ended-queue/-/double-ended-queue-2.1.0-0.tgz#103d3527fd31528f40188130c841efdd78264e5c" + duplexer3@^0.1.4: version "0.1.4" resolved "https://registry.yarnpkg.com/duplexer3/-/duplexer3-0.1.4.tgz#ee01dd1cac0ed3cbc7fdbea37dc0a8f1ce002ce2" @@ -4565,6 +4573,22 @@ redent@^2.0.0: indent-string "^3.0.0" strip-indent "^2.0.0" +redis-commands@^1.2.0: + version "1.3.5" + resolved "https://registry.yarnpkg.com/redis-commands/-/redis-commands-1.3.5.tgz#4495889414f1e886261180b1442e7295602d83a2" + +redis-parser@^2.6.0: + version "2.6.0" + resolved "https://registry.yarnpkg.com/redis-parser/-/redis-parser-2.6.0.tgz#52ed09dacac108f1a631c07e9b69941e7a19504b" + +redis@^2.8.0: + version "2.8.0" + resolved "https://registry.yarnpkg.com/redis/-/redis-2.8.0.tgz#202288e3f58c49f6079d97af7a10e1303ae14b02" + dependencies: + double-ended-queue "^2.1.0-0" + redis-commands "^1.2.0" + redis-parser "^2.6.0" + reduce-css-calc@^1.2.6: version "1.3.0" resolved "https://registry.yarnpkg.com/reduce-css-calc/-/reduce-css-calc-1.3.0.tgz#747c914e049614a4c9cfbba629871ad1d2927716"