From ed6186f63b78a9b7a23918de5d568d261681129b Mon Sep 17 00:00:00 2001 From: joe fleming Date: Tue, 29 Jan 2019 17:01:10 -0700 Subject: [PATCH] fix: make auth an env var so that it can be passed into docker easily --- bin/index.js | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/bin/index.js b/bin/index.js index e0d5da1..ef3b6ba 100644 --- a/bin/index.js +++ b/bin/index.js @@ -7,12 +7,12 @@ const logger = require('../src/lib/logger.mjs').default; const esHost = process.env.ELASTICSEARCH_HOST || 'localhost'; const esPort = process.env.ELASTICSEARCH_PORT || '9200'; +const auth = process.env.ELASTICSEARCH_AUTH || ''; -const { index, interval, lat, lon, radius, ...elasticsearch } = getopts(process.argv.slice(2), { +const { index, interval, lat, lon, radius, ...esConfig } = getopts(process.argv.slice(2), { string: ['host', 'auth', 'log', 'index'], alias: { h: 'host', - u: 'auth', l: 'log', i: 'index', t: 'interval', @@ -35,7 +35,7 @@ function handleError(err) { async function fetchAndIndex() { logger.debug('Fetching and indexing data...'); - return mod(index, { elasticsearch, filter: { lat, lon, radius } }); + return mod(index, { elasticsearch: { ...esConfig, auth }, filter: { lat, lon, radius } }); } async function run() {