feat(auth): add token support for ntfy
- Updated the NTFY service to support API token authentication by adding Authorization Bearer header when api_token is provided. Closes: #89
This commit is contained in:
@@ -32,6 +32,11 @@ func (ns *NtfyService) SendNotification(config *AlertConfiguration, message stri
|
|||||||
req.Header.Set("Title", "🔔 CheckCle Service Alert")
|
req.Header.Set("Title", "🔔 CheckCle Service Alert")
|
||||||
req.Header.Set("Tags", "monitoring")
|
req.Header.Set("Tags", "monitoring")
|
||||||
req.Header.Set("Priority", "default")
|
req.Header.Set("Priority", "default")
|
||||||
|
|
||||||
|
// Add API token authentication if provided
|
||||||
|
if config.APIToken != "" {
|
||||||
|
req.Header.Set("Authorization", "Bearer "+config.APIToken)
|
||||||
|
}
|
||||||
|
|
||||||
// Send the request
|
// Send the request
|
||||||
client := &http.Client{}
|
client := &http.Client{}
|
||||||
@@ -111,6 +116,11 @@ func (ns *NtfyService) SendNotificationWithDetails(config *AlertConfiguration, m
|
|||||||
|
|
||||||
req.Header.Set("Tags", tags)
|
req.Header.Set("Tags", tags)
|
||||||
req.Header.Set("Priority", priority)
|
req.Header.Set("Priority", priority)
|
||||||
|
|
||||||
|
// Add API token authentication if provided
|
||||||
|
if config.APIToken != "" {
|
||||||
|
req.Header.Set("Authorization", "Bearer "+config.APIToken)
|
||||||
|
}
|
||||||
|
|
||||||
// Send the request
|
// Send the request
|
||||||
client := &http.Client{}
|
client := &http.Client{}
|
||||||
|
|||||||
Reference in New Issue
Block a user