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

FEATURE: Support multiple reporters with different options #790

Open
Jamstah opened this issue Jan 29, 2024 · 6 comments · May be fixed by #822
Open

FEATURE: Support multiple reporters with different options #790

Jamstah opened this issue Jan 29, 2024 · 6 comments · May be fixed by #822

Comments

@Jamstah
Copy link
Contributor

Jamstah commented Jan 29, 2024

Interested in thoughts of this style of config

report:
  text: # Still have these for inheritance
    details: true
    footer: true
    line_length: 75
    minimal: false
  html:
    diff: unified
  reporters:
  - type: email
    enabled: true
    from: [email protected]
    to: [email protected]
    method: sendmail
    tags: tag1
  - type: email
    enabled: true
    from: [email protected]
    to: [email protected]
    method: sendmail
    tags: tag2
    html: true
  - type: stdout
    color: true
    enabled: true
  telegram: # Still support dict format
    bot_token: ''
    chat_id: ''
    enabled: false
@thp
Copy link
Owner

thp commented Feb 12, 2024

In general, it's a good idea. And as long as the existing format is still supported, that shouldn't affect existing users.

Not too happy with "reporters" below "report".

We could do it without an additional key. By default, each immediate child (e.g. email) of "report" has as immediate child a dict (e.g. email has a dict with enabled, from, to, ...). If we add support for a list-of-dicts below each reporter, that could do the trick:

report:
  text: # Still have these for inheritance
    details: true
    footer: true
    line_length: 75
    minimal: false
  html:
    diff: unified
  email:
    - enabled: true
      from: [email protected]
      to: [email protected]
      method: sendmail
      tags: tag1
    - enabled: true
      from: [email protected]
      to: [email protected]
      method: sendmail
      tags: tag2
      html: true
  stdout:
    color: true
    enabled: true
  telegram: # Still support dict format
    bot_token: ''
    chat_id: ''
    enabled: false

This would probably be the least intrusive (no new keys), and should be super simple to check (if the immediate child is a dict, treat it as a single config, otherwise if it's a list, treat it as list of multiple configs).

Certain shared/superclass configs (e.g. text and html) obviously wouldn't have the possibility to be specified as list, as there can only be one. Then again, what if you want to have e.g. different text reporter configurations for each of the multiple e-mail reporters defined? This proposal doesn't support that, but maybe that's okay for a first version?

@Jamstah
Copy link
Contributor Author

Jamstah commented Feb 12, 2024

I think it's either make a compromise like either of our suggestions, or create a V2 config file format and redesign it with the new requirements in mind, supporting both formats for now.

I would probably go with a compromise and your option looks good. I'll propose an implementation based on the tagging at some point, when I next get a chance to look at it.

@thp
Copy link
Owner

thp commented Feb 15, 2024

Great, I like the compromise (backwards compatible) variant better, because it means less disruption for existing users. And maybe you can split the possible PRs into two, once that adds multiple reporter configs, and then after that's been merged, a separate on that adds tagging on top (or I guess tagging could be done first, as these are mostly independent?).

@Jamstah
Copy link
Contributor Author

Jamstah commented Feb 16, 2024

I did tagging first because I already had that PR in flight :)

@Jamstah
Copy link
Contributor Author

Jamstah commented Feb 22, 2024

WIP on this, for after tags are merged in: https://github.com/thp/urlwatch/compare/master...Jamstah:multiple-reporters?expand=1

@thp
Copy link
Owner

thp commented Apr 24, 2024

WIP on this, for after tags are merged in: https://github.com/thp/urlwatch/compare/master...Jamstah:multiple-reporters?expand=1

Tags is now merged if you want to tackle this, too.

Jamstah added a commit to Jamstah/urlwatch that referenced this issue May 29, 2024
This allows different jobs to be selected for reporting in different
ways, for example, allowing different changes to be emailed to different
addresses.

Closes thp#790

Signed-off-by: James Hewitt <[email protected]>
@Jamstah Jamstah linked a pull request May 29, 2024 that will close this issue
Jamstah added a commit to Jamstah/urlwatch that referenced this issue May 29, 2024
This allows different jobs to be selected for reporting in different
ways, for example, allowing different changes to be emailed to different
addresses.

Closes thp#790

Signed-off-by: James Hewitt <[email protected]>
Jamstah added a commit to Jamstah/urlwatch that referenced this issue May 29, 2024
This allows different jobs to be selected for reporting in different
ways, for example, allowing different changes to be emailed to different
addresses.

Closes thp#790

Signed-off-by: James Hewitt <[email protected]>
Jamstah added a commit to Jamstah/urlwatch that referenced this issue Aug 5, 2024
This allows different jobs to be selected for reporting in different
ways, for example, allowing different changes to be emailed to different
addresses.

Closes thp#790

Signed-off-by: James Hewitt <[email protected]>
Jamstah added a commit to Jamstah/urlwatch that referenced this issue Aug 5, 2024
This allows different jobs to be selected for reporting in different
ways, for example, allowing different changes to be emailed to different
addresses.

Closes thp#790

Signed-off-by: James Hewitt <[email protected]>
Jamstah added a commit to Jamstah/urlwatch that referenced this issue Aug 5, 2024
This allows different jobs to be selected for reporting in different
ways, for example, allowing different changes to be emailed to different
addresses.

Closes thp#790

Signed-off-by: James Hewitt <[email protected]>
Jamstah added a commit to Jamstah/urlwatch that referenced this issue Aug 5, 2024
This allows different jobs to be selected for reporting in different
ways, for example, allowing different changes to be emailed to different
addresses.

Closes thp#790

Signed-off-by: James Hewitt <[email protected]>
Jamstah added a commit to Jamstah/urlwatch that referenced this issue Aug 5, 2024
This allows different jobs to be selected for reporting in different
ways, for example, allowing different changes to be emailed to different
addresses.

Closes thp#790

Signed-off-by: James Hewitt <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants