2022-01-28 18:37:23 +00:00
|
|
|
const os = require('@opensearch-project/opensearch')
|
2022-01-25 19:34:51 +00:00
|
|
|
|
2022-01-28 19:19:56 +00:00
|
|
|
const options = process.env.NODE_ENV === 'development'
|
|
|
|
? { node: 'http://localhost:9200' }
|
|
|
|
: {
|
|
|
|
node: process.env.OPENSEARCH_URL,
|
|
|
|
auth: {
|
|
|
|
username: process.env.OPENSEARCH_USERNAME,
|
|
|
|
password: process.env.OPENSEARCH_PASSWORD
|
2022-01-28 18:37:23 +00:00
|
|
|
}
|
2022-01-28 19:19:56 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
global.os = global.os || new os.Client(options)
|
2022-01-25 19:34:51 +00:00
|
|
|
|
2022-01-28 18:37:23 +00:00
|
|
|
module.exports = global.os
|