diff --git a/config/defaults.json b/config/defaults.json index 9aae60a..e0e2e54 100644 --- a/config/defaults.json +++ b/config/defaults.json @@ -1,19 +1,7 @@ { "esclient": { - "apiVersion": "7.x", - "keepAlive": true, "requestTimeout": "120000", - "hosts": [{ - "env": "development", - "protocol": "http", - "host": "localhost", - "port": 9200 - }], - "log": [{ - "type": "stdio", - "json": false, - "level": [ "error", "warning" ] - }] + "nodes": ["http://localhost:9200"] }, "elasticsearch": { "settings": { diff --git a/config/env.json b/config/env.json index cb77bd3..5a4bcb0 100644 --- a/config/env.json +++ b/config/env.json @@ -1,19 +1,6 @@ { "esclient": { - "hosts": [ - { - "env": "production", - "protocol": "http", - "host": "localhost", - "port": 9200 - }, - { - "env": "production", - "protocol": "http", - "host": "localhost", - "port": 9300 - } - ] + "nodes": ["http://localhost:9200", "http://localhost:9300"] }, "imports": { "geonames": { diff --git a/test/expected-deep.json b/test/expected-deep.json index 0d947d8..3a6ae26 100644 --- a/test/expected-deep.json +++ b/test/expected-deep.json @@ -1,24 +1,7 @@ { "esclient": { - "apiVersion": "7.x", - "keepAlive": true, "requestTimeout": "120000", - "hosts": [{ - "env": "production", - "protocol": "http", - "host": "localhost", - "port": 9200 - },{ - "env": "production", - "protocol": "http", - "host": "localhost", - "port": 9300 - }], - "log": [{ - "type": "stdio", - "json": false, - "level": [ "error", "warning" ] - }] + "nodes": ["http://localhost:9200", "http://localhost:9300"] }, "elasticsearch": { "settings": { diff --git a/test/generate.js b/test/generate.js index 787964f..c5ae934 100644 --- a/test/generate.js +++ b/test/generate.js @@ -16,8 +16,8 @@ module.exports.generate.development = function(test) { t.equal(typeof config, 'object', 'valid function'); t.deepEqual(c, defaults, 'defaults'); t.equal(typeof c.esclient, 'object', 'valid property'); - t.equal(Object.keys(c.esclient).length, 5, 'copied all default properties'); - t.equal(c.esclient.hosts.length, 1, 'defaults'); + t.equal(Object.keys(c.esclient).length, 2, 'copied all default properties'); + t.equal(c.esclient.nodes.length, 1, 'defaults'); t.end(); // reset localpath @@ -37,7 +37,7 @@ module.exports.generate.production = function(test) { t.notDeepEqual(c, defaults, 'valid function'); t.equal(typeof c.esclient, 'object', 'valid property'); t.equal(Object.keys(c.esclient).length, 1, 'deleted all default properties'); - t.equal(c.esclient.hosts.length, 2, 'shallow merge'); + t.equal(c.esclient.nodes.length, 2, 'shallow merge'); t.end(); // unset the PELIAS_CONFIG env var @@ -52,8 +52,8 @@ module.exports.generate.production = function(test) { t.equal(typeof config, 'object', 'valid function'); t.notDeepEqual(c, defaults, 'valid function'); t.equal(typeof c.esclient, 'object', 'valid property'); - t.equal(Object.keys(c.esclient).length, 5, 'keep all default properties'); - t.equal(c.esclient.hosts.length, 2, 'deep merge should set two hosts'); + t.equal(Object.keys(c.esclient).length, 2, 'keep all default properties'); + t.equal(c.esclient.nodes.length, 2, 'deep merge should set two nodes'); t.end(); // unset the PELIAS_CONFIG env var @@ -68,8 +68,8 @@ module.exports.generate.production = function(test) { t.equal(typeof config, 'object', 'valid function'); t.notDeepEqual(c, defaults, 'valid function'); t.equal(typeof c.esclient, 'object', 'valid property'); - t.equal(Object.keys(c.esclient).length, 5, 'keep all default properties'); - t.equal(c.esclient.hosts.length, 2, 'deep merge should set two hosts'); + t.equal(Object.keys(c.esclient).length, 2, 'keep all default properties'); + t.equal(c.esclient.nodes.length, 2, 'deep merge should set two nodes'); t.end(); // unset the PELIAS_CONFIG env var @@ -103,7 +103,7 @@ module.exports.generate.local = function(test) { t.equal(typeof config, 'object', 'valid function'); t.notDeepEqual(c, defaults, 'valid function'); t.equal(typeof c.esclient, 'object', 'valid property'); - t.equal(Object.keys(c.esclient).length, 5, 'keep all default properties'); + t.equal(Object.keys(c.esclient).length, 2, 'keep all default properties'); t.equal(c.interpolation.client.adapter, 'http', 'interpolation client'); t.equal(c.interpolation.client.host, 'http://localhost:9999', 'interpolation client'); t.equal(c.imports.geonames.datapath, '/media/hdd', 'local paths');