Skip to content

Commit

Permalink
Support ZOOKEEPER_PATH environment variable, fixes #88
Browse files Browse the repository at this point in the history
  • Loading branch information
euphoria committed Mar 31, 2016
1 parent 1729d29 commit b19d9a1
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 4 deletions.
7 changes: 6 additions & 1 deletion src/config/config.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,8 @@ var config = {
// Backend API URLs.
// Set this to 'http://127.0.0.1:8000' for using the stub server running in DEV mode.
'mesosEndpoint': (typeof(document) !== 'undefined' ? document.location.origin : null),
'proxyPath': '/proxy'
'proxyPath': '/proxy',
'zookeeperPath': '/mesos'
};

if (process.env.ZOOKEEPER_ADDRESS) {
Expand All @@ -15,4 +16,8 @@ if (process.env.ZOOKEEPER_ADDRESS) {
config.mesosEndpoint = config.proxyPath;
}

if (process.env.ZOOKEEPER_PATH) {
config.zookeeperPath = process.env.ZOOKEEPER_PATH;
}

module.exports = config;
6 changes: 3 additions & 3 deletions src/routes/zookeeper.js
Original file line number Diff line number Diff line change
Expand Up @@ -17,10 +17,10 @@ module.exports = function(app) {
client.once('connected', function () {
console.log('Connected to the Zookeeper.');

listChildren(client, '/mesos').then(function(childrenList) {
listChildren(client, config.zookeeperPath).then(function(childrenList) {
// The smallest one is the leader.
childrenList.sort();
return getData(client, '/mesos/' + childrenList[0]);
return getData(client, config.zookeeperPath + '/' + childrenList[0]);
}).then(function(jsonData) {
// The top-level React component + HTML template for it
let leader = 'http://' + jsonData.address.ip + ':' + jsonData.address.port;
Expand Down Expand Up @@ -74,7 +74,7 @@ module.exports = function(app) {
listChildren(client, path).then(function(childrenList) {
// The smallest one is the leader.
childrenList.sort();
return getData(client, '/mesos/' + childrenList[0]);
return getData(client, path + '/' + childrenList[0]);
}).then(function(jsonData) {
var config = require('../config/config');
// The top-level React component + HTML template for it
Expand Down

0 comments on commit b19d9a1

Please sign in to comment.