Skip to content

Commit

Permalink
cli options from env
Browse files Browse the repository at this point in the history
  • Loading branch information
alexv-ds committed Jul 25, 2024
1 parent ee14a60 commit 812ef0e
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 20 deletions.
22 changes: 11 additions & 11 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -70,17 +70,17 @@ node your-app.js | pino-gelf log -t

__Note__: The defaults for these options are:

Property|Default
---|---
Host|`127.0.0.1`
Port|`12201`
Protocol|`udp`
Maximum Chunk Size|`1420`
Keep Alive|`true`
Reconnection limit|`-1 (no limit)`
Reconnection delay|`1000`
Verbose Logging|`false`
Passthrough|`false`
Property|Environment Variable|Default
---|---|---
Host|`PINO_GELF_HOST`|`127.0.0.1`
Port|`PINO_GELF_PORT`|`12201`
Protocol|`PINO_GELF_PROTOCOL`|`udp`
Maximum Chunk Size|`PINO_GELF_MAX_CHUNK_SIZE`|`1420`
Keep Alive|`PINO_GELF_KEEP_ALIVE`|`true`
Reconnection limit|`PINO_GELF_RECONNECTION_LIMIT`|`-1 (no limit)`
Reconnection delay|`PINO_GELF_RECONNECTION_DELAY`|`1000`
Verbose Logging|-|`false`
Passthrough|-|`false`


## Example
Expand Down
18 changes: 9 additions & 9 deletions index.js
100644 → 100755
Original file line number Diff line number Diff line change
Expand Up @@ -12,15 +12,15 @@ program
program
.command('log')
.description('Run Pino-GELF')
.option('-h, --host [host]', 'Graylog Host')
.option('-p, --port [port]', 'Graylog Port', parseInt)
.option('-P, --protocol [protocol]', 'Graylog protocol (UDP, HTTP, HTTPS, TCP, TLS)')
.option('-m, --max-chunk-size [maxChunkSize]', 'Graylog UDP Input Maximum Chunk Size', parseInt)
.option('-k, --keep-alive [keepAlive]', 'HTTP/TCP keep alive')
.option('-r, --reconnection-limit [reconnectionLimit]', 'TCP reconnection limit', parseInt)
.option('-d, --reconnection-delay [reconnectionDelay]', 'TCP reconnection delay', parseInt)
.option('-v, --verbose', 'Output GELF to console')
.option('-t, --passthrough', 'Output original input to stdout to allow command chaining')
.addOption(new program.Option('-h, --host [host]', 'Graylog Host').env('PINO_GELF_HOST'))
.addOption(new program.Option('-p, --port [port]', 'Graylog Port').env('PINO_GELF_PORT').argParser(parseInt))
.addOption(new program.Option('-P, --protocol [protocol]', 'Graylog protocol (UDP, HTTP, HTTPS, TCP, TLS)').env('PINO_GELF_PROTOCOL'))
.addOption(new program.Option('-m, --max-chunk-size [maxChunkSize]', 'Graylog UDP Input Maximum Chunk Size').env('PINO_GELF_MAX_CHUNK_SIZE').argParser(parseInt))
.addOption(new program.Option('-k, --keep-alive [keepAlive]', 'HTTP/TCP keep alive').env('PINO_GELF_KEEP_ALIVE'))
.addOption(new program.Option('-r, --reconnection-limit [reconnectionLimit]', 'TCP reconnection limit').env('PINO_GELF_RECONNECTION_LIMIT').argParser(parseInt))
.addOption(new program.Option('-d, --reconnection-delay [reconnectionDelay]', 'TCP reconnection delay').env('PINO_GELF_RECONNECTION_DELAY').argParser(parseInt))
.addOption(new program.Option('-v, --verbose', 'Output GELF to console'))
.addOption(new program.Option('-t, --passthrough', 'Output original input to stdout to allow command chaining'))
.action(function () {
const options = this.opts();

Expand Down

0 comments on commit 812ef0e

Please sign in to comment.