Compare commits
2 Commits
Author | SHA1 | Date | |
---|---|---|---|
d6176f820a | |||
0ebc1d5288 |
@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "@apiclient.xyz/elasticsearch",
|
"name": "@apiclient.xyz/elasticsearch",
|
||||||
"version": "1.0.42",
|
"version": "1.0.43",
|
||||||
"private": false,
|
"private": false,
|
||||||
"description": "log to elasticsearch in a kibana compatible format",
|
"description": "log to elasticsearch in a kibana compatible format",
|
||||||
"main": "dist_ts/index.js",
|
"main": "dist_ts/index.js",
|
||||||
|
@ -9,8 +9,10 @@ tap.test('first test', async () => {
|
|||||||
indexPrefix: 'testprefix',
|
indexPrefix: 'testprefix',
|
||||||
indexRetention: 7,
|
indexRetention: 7,
|
||||||
node: 'http://localhost:9200',
|
node: 'http://localhost:9200',
|
||||||
user: 'elastic',
|
auth: {
|
||||||
pass: 'YourPassword'
|
username: 'elastic',
|
||||||
|
password: 'YourPassword'
|
||||||
|
}
|
||||||
});
|
});
|
||||||
expect(testElasticLog).toBeInstanceOf(elasticsearch.ElasticSearch);
|
expect(testElasticLog).toBeInstanceOf(elasticsearch.ElasticSearch);
|
||||||
});
|
});
|
||||||
|
@ -3,6 +3,6 @@
|
|||||||
*/
|
*/
|
||||||
export const commitinfo = {
|
export const commitinfo = {
|
||||||
name: '@apiclient.xyz/elasticsearch',
|
name: '@apiclient.xyz/elasticsearch',
|
||||||
version: '1.0.42',
|
version: '1.0.43',
|
||||||
description: 'log to elasticsearch in a kibana compatible format'
|
description: 'log to elasticsearch in a kibana compatible format'
|
||||||
}
|
}
|
||||||
|
@ -15,8 +15,10 @@ export interface IElasticSearchConstructorOptions {
|
|||||||
indexPrefix: string;
|
indexPrefix: string;
|
||||||
indexRetention: number;
|
indexRetention: number;
|
||||||
node: string;
|
node: string;
|
||||||
user?: string;
|
auth?: {
|
||||||
pass?: string;
|
username: string;
|
||||||
|
password: string;
|
||||||
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
export class ElasticSearch<T> {
|
export class ElasticSearch<T> {
|
||||||
@ -34,10 +36,7 @@ export class ElasticSearch<T> {
|
|||||||
constructor(optionsArg: IElasticSearchConstructorOptions) {
|
constructor(optionsArg: IElasticSearchConstructorOptions) {
|
||||||
this.client = new ElasticClient({
|
this.client = new ElasticClient({
|
||||||
node: optionsArg.node,
|
node: optionsArg.node,
|
||||||
auth: {
|
...(optionsArg.auth && { auth: optionsArg.auth }),
|
||||||
username: optionsArg.user,
|
|
||||||
password: optionsArg.pass,
|
|
||||||
}
|
|
||||||
});
|
});
|
||||||
this.indexPrefix = optionsArg.indexPrefix;
|
this.indexPrefix = optionsArg.indexPrefix;
|
||||||
this.indexRetention = optionsArg.indexRetention;
|
this.indexRetention = optionsArg.indexRetention;
|
||||||
|
Reference in New Issue
Block a user