pino-elasticsearch
Advanced tools
Comparing version 6.6.0 to 6.7.0
97
cli.js
@@ -36,2 +36,6 @@ #! /usr/bin/env node | ||
if (opts.rejectUnauthorized) { | ||
opts.rejectUnauthorized = opts.rejectUnauthorized !== 'false' | ||
} | ||
const stream = pinoElasticSearch(opts) | ||
@@ -49,45 +53,64 @@ | ||
if (opts.rejectUnauthorized) { | ||
opts.rejectUnauthorized = opts.rejectUnauthorized !== 'false' | ||
} | ||
pump(process.stdin, stream) | ||
} | ||
const flags = minimist(process.argv.slice(2), { | ||
alias: { | ||
version: 'v', | ||
help: 'h', | ||
node: 'n', | ||
index: 'i', | ||
'flush-bytes': 'f', | ||
'flush-interval': 't', | ||
'trace-level': 'l', | ||
username: 'u', | ||
password: 'p', | ||
'api-key': 'k', | ||
cloud: 'c', | ||
'read-config': 'r' | ||
}, | ||
default: { | ||
node: 'http://localhost:9200' | ||
function startCli (flags) { | ||
const allowedProps = [ | ||
'node', | ||
'index', | ||
'flush-bytes', | ||
'flush-interval', | ||
'trace-level', | ||
'username', | ||
'password', | ||
'api-key', | ||
'cloud', | ||
'es-version', | ||
'rejectUnauthorized' | ||
] | ||
if (flags['read-config']) { | ||
if (flags['read-config'].match(/.*\.json$/) !== null) { | ||
const config = JSON.parse(fs.readFileSync(path.join(process.cwd(), flags['read-config']), 'utf-8')) | ||
allowedProps.forEach(key => { | ||
if (config[key] !== undefined) { | ||
flags[key] = config[key] | ||
} | ||
}) | ||
} | ||
if (flags['read-config'].match(/.*\.js$/) !== null) { | ||
const config = require(path.join(process.cwd(), flags['read-config'])) | ||
allowedProps.forEach(key => { | ||
if (config[key] !== undefined) { | ||
flags[key] = config[key] | ||
} | ||
}) | ||
} | ||
} | ||
}) | ||
const allowedProps = ['node', 'index', 'flush-bytes', 'flush-interval', 'trace-level', 'username', 'password', 'api-key', 'cloud', 'es-version', 'rejectUnauthorized'] | ||
start(flags) | ||
} | ||
if (flags['read-config']) { | ||
if (flags['read-config'].match(/.*\.json$/) !== null) { | ||
const config = JSON.parse(fs.readFileSync(path.join(process.cwd(), flags['read-config']), 'utf-8')) | ||
allowedProps.forEach(key => { | ||
if (config[key]) { flags[key] = config[key] } | ||
}) | ||
} | ||
if (require.main === module) { | ||
startCli(minimist(process.argv.slice(2), { | ||
alias: { | ||
version: 'v', | ||
help: 'h', | ||
node: 'n', | ||
index: 'i', | ||
'flush-bytes': 'f', | ||
'flush-interval': 't', | ||
'trace-level': 'l', | ||
username: 'u', | ||
password: 'p', | ||
'api-key': 'k', | ||
cloud: 'c', | ||
'read-config': 'r' | ||
}, | ||
default: { | ||
node: 'http://localhost:9200' | ||
} | ||
})) | ||
} | ||
if (flags['read-config'].match(/.*\.js$/) !== null) { | ||
const config = require(path.join(process.cwd(), flags['read-config'])) | ||
allowedProps.forEach(key => { | ||
if (config[key]) { flags[key] = config[key] } | ||
}) | ||
} | ||
} | ||
start(flags) | ||
module.exports = startCli |
{ | ||
"name": "pino-elasticsearch", | ||
"version": "6.6.0", | ||
"version": "6.7.0", | ||
"description": "Load pino logs into ElasticSearch", | ||
@@ -33,3 +33,3 @@ "main": "./lib.js", | ||
"tap": "^16.0.0", | ||
"tsd": "^0.28.1" | ||
"tsd": "^0.29.0" | ||
}, | ||
@@ -36,0 +36,0 @@ "dependencies": { |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
63240
24
1149