pinojs / pino-gelf

🌲 Convert Pino logs to GELF format and send to Graylog
Apache License 2.0
13 stars 10 forks source link

Environment variables instead of CLI options #256

Closed alexv-ds closed 1 month ago

alexv-ds commented 2 months ago

Added the ability for options to take data from environment variables if the option is not specified in the CLI.

Example usage (docker compose):

service:
  my_app:
    image: myimage
    command: node main.js | npx pino-gelf log
    environment:
      PINO_GELF_HOST: log-server.host
      PINO_GELF_PROTOCOL: tcp
      PINO_GELF_RECONNECTION_DELAY: 2000
      PINO_GELF_KEEP_ALIVE: 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
alexv-ds commented 1 month ago

Rebased master onto env-options branch

257