You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@openwhisk.apache.org by cs...@apache.org on 2018/01/16 16:39:17 UTC

[incubator-openwhisk-package-alarms] branch master updated: support SSL for redis (#122)

This is an automated email from the ASF dual-hosted git repository.

csantanapr pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/incubator-openwhisk-package-alarms.git


The following commit(s) were added to refs/heads/master by this push:
     new 03c324b  support SSL for redis (#122)
03c324b is described below

commit 03c324bb01cce7d5d32f9fd0551381864873e1fe
Author: Jason Peterson <ja...@us.ibm.com>
AuthorDate: Tue Jan 16 11:39:14 2018 -0500

    support SSL for redis (#122)
---
 Dockerfile      |  2 +-
 provider/app.js | 14 +++++++++++++-
 2 files changed, 14 insertions(+), 2 deletions(-)

diff --git a/Dockerfile b/Dockerfile
index 03f4472..87d6a86 100644
--- a/Dockerfile
+++ b/Dockerfile
@@ -10,7 +10,7 @@ RUN apt-get update --fix-missing && \
   apt-get install -y curl && \
   apt-get update && \
   apt-get remove -y nodejs && \
-  curl -sL https://deb.nodesource.com/setup_6.x | bash - && \
+  curl -sL https://deb.nodesource.com/setup_8.x | bash - && \
   apt-get install -y nodejs
 
 # only package.json
diff --git a/provider/app.js b/provider/app.js
index 9ba5f98..afd880d 100755
--- a/provider/app.js
+++ b/provider/app.js
@@ -3,6 +3,7 @@
  * Service which can be configured to listen for triggers from a provider.
  * The Provider will store, invoke, and POST whisk events appropriately.
  */
+var URL = require('url').URL;
 var http = require('http');
 var express = require('express');
 var bodyParser = require('body-parser');
@@ -129,9 +130,20 @@ function createRedisClient() {
 
     return new Promise(function(resolve, reject) {
         if (redisUrl) {
+            var client;
             var redis = require('redis');
             bluebird.promisifyAll(redis.RedisClient.prototype);
-            var client = redis.createClient(redisUrl);
+            if (redisUrl.startsWith('rediss://')) {
+                // If this is a rediss: connection, we have some other steps.
+                client = redis.createClient(redisUrl, {
+                    tls: { servername: new URL(redisUrl).hostname }
+                });
+                // This will, with node-redis 2.8, emit an error:
+                // "node_redis: WARNING: You passed "rediss" as protocol instead of the "redis" protocol!"
+                // This is a bogus message and should be fixed in a later release of the package.
+            } else {
+                client = redis.createClient(redisUrl);
+            }
 
             client.on('connect', function () {
                 resolve(client);

-- 
To stop receiving notification emails like this one, please contact
['"commits@openwhisk.apache.org" <co...@openwhisk.apache.org>'].