fix: make auth an env var
so that it can be passed into docker easily
This commit is contained in:
@@ -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() {
|
||||
|
||||
Reference in New Issue
Block a user