From 2e8e3ecfc1900bad13f1c96fa85bd10e141bb438 Mon Sep 17 00:00:00 2001 From: celevra Date: Fri, 6 May 2016 09:01:19 +0200 Subject: [PATCH] null is also defined if (typeof null != "undefined") console.log('could be that this is the test node-etcd is using'); --- lib/etcd.js | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/lib/etcd.js b/lib/etcd.js index 3d51afa..f477314 100644 --- a/lib/etcd.js +++ b/lib/etcd.js @@ -7,7 +7,6 @@ var MAX_TRIES = 3; var BACKOFF = 2; var endpoints = []; -var sslopts = null; if(!process.env.ETCD_ENDPOINTS) { endpoints.push('127.0.0.1:4001'); } else { @@ -19,7 +18,7 @@ if(!process.env.ETCD_ENDPOINTS) { }); if(ssl) { - sslopts = { + var sslopts = { ca: fs.readFileSync(process.env.ETCD_CAFILE), cert: fs.readFileSync(process.env.ETCD_CERTFILE), key: fs.readFileSync(process.env.ETCD_KEYFILE), @@ -30,7 +29,10 @@ if(!process.env.ETCD_ENDPOINTS) { console.log('Etcd peers:', process.env.ETCD_ENDPOINTS); -var etcd = new Etcd(endpoints, sslopts); +if (ssl) + var etcd = new Etcd(endpoints, sslopts); +else + var etcd = new Etcd(endpoints); // mixin some useful methods function deepFindKeys(node, regexp) {