feat: add basic auth support
This commit is contained in:
@@ -6,9 +6,10 @@ const mod = require('../src/index.mjs').default;
|
|||||||
const logger = require('../src/lib/logger.mjs').default;
|
const logger = require('../src/lib/logger.mjs').default;
|
||||||
|
|
||||||
const { index, interval, ...elasticsearch } = getopts(process.argv.slice(2), {
|
const { index, interval, ...elasticsearch } = getopts(process.argv.slice(2), {
|
||||||
string: ['host', 'log'],
|
string: ['host', 'auth', 'log', 'index'],
|
||||||
alias: {
|
alias: {
|
||||||
h: 'host',
|
h: 'host',
|
||||||
|
u: 'auth',
|
||||||
l: 'log',
|
l: 'log',
|
||||||
i: 'index',
|
i: 'index',
|
||||||
t: 'interval',
|
t: 'interval',
|
||||||
|
|||||||
@@ -9,6 +9,7 @@ export default async function(indexName, opts = {}) {
|
|||||||
const client = new elasticsearch.Client({
|
const client = new elasticsearch.Client({
|
||||||
host: opts.elasticsearch.host,
|
host: opts.elasticsearch.host,
|
||||||
log: opts.elasticsearch.log,
|
log: opts.elasticsearch.log,
|
||||||
|
httpAuth: opts.elasticsearch.auth,
|
||||||
});
|
});
|
||||||
|
|
||||||
// make sure we can connect to the node
|
// make sure we can connect to the node
|
||||||
|
|||||||
Reference in New Issue
Block a user