Add EL auth config

This commit is contained in:
Chocobozzz 2021-02-04 08:55:02 +01:00
parent 9d977fd31c
commit c29e7f02df
No known key found for this signature in database
GPG Key ID: 583A612D890159BE
3 changed files with 16 additions and 0 deletions

View File

@ -10,6 +10,9 @@ webserver:
elastic-search:
# https or http
http: 'http'
auth:
username: null
password: null
ssl:
# Specificy a custom CA
ca: null

View File

@ -17,6 +17,15 @@ if (CONFIG.ELASTIC_SEARCH.SSL.CA) {
})
}
if (CONFIG.ELASTIC_SEARCH.AUTH.USERNAME) {
Object.assign(elasticOptions, {
auth: {
username: CONFIG.ELASTIC_SEARCH.AUTH.USERNAME,
password: CONFIG.ELASTIC_SEARCH.AUTH.PASSWORD
}
})
}
const elasticSearch = new Client(elasticOptions)
function buildSort (value: string) {

View File

@ -14,6 +14,10 @@ const CONFIG = {
},
ELASTIC_SEARCH: {
HTTP: config.get<string>('elastic-search.http'),
AUTH: {
USERNAME: config.get<string>('elastic-search.auth.username'),
PASSWORD: config.get<string>('elastic-search.auth.password')
},
SSL: {
CA: config.get<string>('elastic-search.ssl.ca')
},