Skip to content
This repository has been archived by the owner on Dec 23, 2024. It is now read-only.

Add Discord webhook notification support #37

Closed
wants to merge 4 commits into from

Conversation

s0up4200
Copy link
Owner

@s0up4200 s0up4200 commented Oct 24, 2024

No description provided.

s0up4200 and others added 4 commits October 25, 2024 00:06
* **config.toml**
  - Add `discord_webhook_url` setting under `[notifications]` section

* **cmd/redactedhook/main.go**
  - Import `net/http` and `bytes` packages
  - Add `sendDiscordNotification` function to send POST request to Discord webhook URL
  - Call `sendDiscordNotification` in `WebhookHandler` when responding with HTTP status 200

* **internal/config/config_structs.go**
  - Add `DiscordWebhookURL` field in `Notifications` struct

* **internal/config/config.go**
  - Update `InitConfig` to read `discord_webhook_url` setting

* **internal/api/handlers.go**
  - Import `net/http` and `bytes` packages
  - Add `sendDiscordNotification` function to send POST request to Discord webhook URL
  - Call `sendDiscordNotification` in `WebhookHandler` when responding with HTTP status 200

* **internal/api/handlers_test.go**
  - Add `TestSendDiscordNotification` to test `sendDiscordNotification` function
@s0up4200 s0up4200 closed this Dec 21, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant