[BUG] Gotify fallback webhook URL is missing token placeholder

Open Beginner friendly
#4,349 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Assessment

Difficulty
1/5
Estimated time
Under an hour
Newbie friendliness
92/100
Issue type
Bug
Clarity
Clearly specified
Activity status
Active
Tech stack
java

Research direction

Start by comparing the fallback value in AlerterProperties.java with the formatting call in GotifyAlertNotifyHandlerImpl. Confirm that the fallback URL contains the token placeholder and that formatting it with a receiver token produces the expected Gotify URL.

Written by the indexing model from the issue text.

Description

bug
Is there an existing issue for this?
  • I have searched the existing issues
Current Behavior
Describe the bug

AlerterProperties.java defines the fallback default Gotify webhook URL as:

private String gotifyWebhookUrl = "https://push.example.de/message?token=";

But GotifyAlertNotifyHandlerImpl formats this value with the receiver token:

String webHookUrl = String.format(alerterProperties.getGotifyWebhookUrl(), receiver.getGotifyToken());

Because the fallback default does not contain a %s placeholder, String.format() ignores receiver.getGotifyToken(). If this Java fallback value is used, the generated URL becomes:

https://push.example.de/message?token=

instead of including the Gotify token.

The configured value in application.yml already uses the expected format:

gotify-webhook-url: http://127.0.0.1/message?token=%s

So the Java fallback default should be consistent with the configured default.

Expected Behavior

The fallback default should include the token placeholder:

private String gotifyWebhookUrl = "https://push.example.de/message?token=%s";
Steps To Reproduce

No response

Environment
HertzBeat master branch / 2.0-SNAPSHOT.
Debug logs

No response

Anything else?

No response

Dominant language
Java
Stars
7.4k
Forks
1.3k
Avg merge
16h 20m
Merged PRs (30d)
22

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from apache/hertzbeat

All issues in apache/hertzbeat

Similar issues

More Java issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.