Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Environment variables instead of CLI options #256

Merged
merged 1 commit into from
Jul 25, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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