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

Use one grafana-ntfy connector for multiple server & Priority support #7

Open
wants to merge 5 commits into
base: main
Choose a base branch
from

Conversation

hugoallaine
Copy link

@hugoallaine hugoallaine commented Dec 10, 2024

This PR contains code to support forward message to a ntfy server and priority.

Instead of starting the grafana-ntfy connector by giving a ntfy server address, the address is extracted from the url of the request (and priority too if precised). In Grafana, you can write this in the url contact point for example:
http://<grafana-ntfy-connector-addr>:8080?url=http://<ntfy-server-addr>:3500/<topic>&priority=5
It allows also to send to multiple topics of a ntfy server without starting another connector.

This is my first time with Go, please give me tips if something is badly written.

This PR contains the code from @angaz #4 for forward auth (cause I used it for my project)

@academo
Copy link
Owner

academo commented Jan 3, 2025

Hi @hugoallaine thanks so much for your PR. I just got some time after holidays to take a look at it.

I merged #4 to main so now this PR only shows your changes.

I like the idea of getting the url from the Grafana request but your current approach is a big breaking change. It'll require anyone using the tool to reconfigure their alerting.

What if instead of removing the option to define the ntfy url as a flag to the program, you modify the sendNotification (and the code that calls it) so if it detects the request comes with the specific ntfy-url it overwrites whatever is defined via flag?

This is an easy way to keep backwards compatibility and still support your use case.

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 this pull request may close these issues.

2 participants