aboutsummaryrefslogtreecommitdiffhomepage
path: root/src
diff options
context:
space:
mode:
authorJohannes Zellner <johannes@cloudron.io>2017-02-09 14:47:47 +0100
committerJohannes Zellner <johannes@cloudron.io>2017-02-09 14:47:47 +0100
commit767595d95870eb7cd37fa041708101eead4039db (patch)
tree0462d6a963f50c03fcf325cae4165edb526a68a7 /src
parentc14b91b15062a37206715a5820a387bb75b2418f (diff)
downloadSurfer-767595d95870eb7cd37fa041708101eead4039db.tar.gz
Surfer-767595d95870eb7cd37fa041708101eead4039db.tar.zst
Surfer-767595d95870eb7cd37fa041708101eead4039db.zip
store stringified objects in redis for now
Diffstat (limited to 'src')
-rw-r--r--src/auth.js10
1 files changed, 8 insertions, 2 deletions
diff --git a/src/auth.js b/src/auth.js
index 09ec8b7..0338632 100644
--- a/src/auth.js
+++ b/src/auth.js
@@ -39,8 +39,14 @@ if (process.env.REDIS_URL) {
39 } 39 }
40 40
41 // overwrite the tokenStore api 41 // overwrite the tokenStore api
42 tokenStore.get = redisClient.get.bind(redisClient); 42 tokenStore.get = function (token, callback) {
43 tokenStore.set = redisClient.set.bind(redisClient); 43 redisClient.get(token, function (error, result) {
44 callback(error || null, safe.JSON.parse(result));
45 });
46 };
47 tokenStore.set = function (token, data, callback) {
48 redisClient.set(token, JSON.stringify(data), callback);
49 };
44 tokenStore.del = redisClient.del.bind(redisClient); 50 tokenStore.del = redisClient.del.bind(redisClient);
45} else { 51} else {
46 console.log('Use in-memory token store'); 52 console.log('Use in-memory token store');