Skip to content

Commit

Permalink
fixed 🐛 introduced in ioHelper
Browse files Browse the repository at this point in the history
  • Loading branch information
ferronrsmith committed May 18, 2022
1 parent 6f5ddf2 commit a72a2ff
Showing 1 changed file with 10 additions and 12 deletions.
22 changes: 10 additions & 12 deletions lib/ioHelper.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,17 +5,15 @@ const s3urls = require('s3urls')

const getIo = (elasticdump, type) => {
let EntryProto
const transportPath = elasticdump.options[type]
const transport = elasticdump.options[`${type}Transport`]
if (transportPath && !transport) {
if (isUrl(transportPath)) {
if (elasticdump.options[type] && !elasticdump.options[`${type}Transport`]) {
if (isUrl(elasticdump.options[type])) {
elasticdump[`${type}Type`] = 'elasticsearch'
if (elasticdump.options.httpAuthFile) {
elasticdump.options[type] = addAuth(transportPath, elasticdump.options.httpAuthFile)
elasticdump.options[type] = addAuth(elasticdump.options[type], elasticdump.options.httpAuthFile)
}
} else if (isS3Prefix(transportPath) && s3urls.valid(transportPath)) {
} else if (isS3Prefix(elasticdump.options[type]) && s3urls.valid(elasticdump.options[type])) {
elasticdump[`${type}Type`] = 's3'
} else if (isCsvUrl(transportPath)) {
} else if (isCsvUrl(elasticdump.options[type])) {
elasticdump[`${type}Type`] = 'csv'
} else {
elasticdump[`${type}Type`] = 'file'
Expand All @@ -35,12 +33,12 @@ const getIo = (elasticdump, type) => {
}

EntryProto = require(path.join(__dirname, 'transports', elasticdump[`${type}Type`]))[elasticdump[`${type}Type`]]
elasticdump[type] = (new EntryProto(elasticdump, transportPath, inputOpts))
} else if (transport) {
elasticdump[`${type}Type`] = String(transport)
EntryProto = require(transport)
elasticdump[type] = (new EntryProto(elasticdump, elasticdump.options[type], inputOpts))
} else if (elasticdump.options[`${type}Transport`]) {
elasticdump[`${type}Type`] = String(elasticdump.options[`${type}Transport`])
EntryProto = require(elasticdump.options[`${type}Transport`])
const EntryProtoKeys = Object.keys(EntryProto)
elasticdump[type] = (new EntryProto[EntryProtoKeys[0]](elasticdump, transportPath, elasticdump.options[`${type}-index`]))
elasticdump[type] = (new EntryProto[EntryProtoKeys[0]](elasticdump, elasticdump.options[type], elasticdump.options[`${type}-index`]))
}
}

Expand Down

0 comments on commit a72a2ff

Please sign in to comment.