mirror of
https://iceshrimp.dev/limepotato/jormungandr-bite.git
synced 2024-11-26 03:47:40 -07:00
ElasticSearchで認証ができるように (#6158)
This commit is contained in:
parent
d456425b81
commit
a919a61b2f
3 changed files with 10 additions and 3 deletions
|
@ -88,7 +88,9 @@ redis:
|
||||||
#elasticsearch:
|
#elasticsearch:
|
||||||
# host: localhost
|
# host: localhost
|
||||||
# port: 9200
|
# port: 9200
|
||||||
# pass: null
|
# ssl: false
|
||||||
|
# user:
|
||||||
|
# pass:
|
||||||
|
|
||||||
# ┌───────────────┐
|
# ┌───────────────┐
|
||||||
#───┘ ID generation └───────────────────────────────────────────
|
#───┘ ID generation └───────────────────────────────────────────
|
||||||
|
|
|
@ -27,9 +27,10 @@ export type Source = {
|
||||||
elasticsearch: {
|
elasticsearch: {
|
||||||
host: string;
|
host: string;
|
||||||
port: number;
|
port: number;
|
||||||
pass: string;
|
|
||||||
index?: string;
|
|
||||||
ssl?: boolean;
|
ssl?: boolean;
|
||||||
|
user?: string;
|
||||||
|
pass?: string;
|
||||||
|
index?: string;
|
||||||
};
|
};
|
||||||
|
|
||||||
proxy?: string;
|
proxy?: string;
|
||||||
|
|
|
@ -33,6 +33,10 @@ const index = {
|
||||||
// Init ElasticSearch connection
|
// Init ElasticSearch connection
|
||||||
const client = config.elasticsearch ? new elasticsearch.Client({
|
const client = config.elasticsearch ? new elasticsearch.Client({
|
||||||
node: `${config.elasticsearch.ssl ? 'https://' : 'http://'}${config.elasticsearch.host}:${config.elasticsearch.port}`,
|
node: `${config.elasticsearch.ssl ? 'https://' : 'http://'}${config.elasticsearch.host}:${config.elasticsearch.port}`,
|
||||||
|
auth: (config.elasticsearch.user && config.elasticsearch.pass) ? {
|
||||||
|
username: config.elasticsearch.user,
|
||||||
|
password: config.elasticsearch.pass
|
||||||
|
} : undefined,
|
||||||
pingTimeout: 30000
|
pingTimeout: 30000
|
||||||
}) : null;
|
}) : null;
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue