pinojs / pino-elasticsearch

🌲 load pino logs into Elasticsearch
MIT License
179 stars 67 forks source link

fix bug: opts.rejectUnauthorized for SSL option #171

Closed nasyarobby closed 1 year ago

nasyarobby commented 1 year ago

Using cli args

the options passed to the client does not include rejectUnauthorized because the value is added after the client is create. So, I moved the code right before the client creation.

Using configuration file

the check for allowed keys will skip the key if the value is false, so the options will not include the key. To fix this, the code should only skip if the value is undefined.

allowedProps.forEach(key => {
      if (config[key] !== undefined) { flags[key] = config[key] }
    })
mcollina commented 1 year ago

Could you add a test for this?

nasyarobby commented 1 year ago

sorry for late reply. Sure, can I just write a unit test to make sure the option passed to the client? Or I need to test using the ES (I assume so when I see those docker-compose files) ?

mcollina commented 1 year ago

the former is ok

nasyarobby commented 1 year ago

@mcollina
Added a new test file for the cli and made some changes to file cli.js so I can make unit tests for it. I only write some tests for starter, but I hope that is enough to cover the issue I try to raise in this PR.