Files
MokoGitea/modules/setting/ntfy.go
Jonathan Miller a66f88e0bf feat(notify): native ntfy push notification integration (#41)
Add ntfy as a native notification channel via the Notifier interface.

Events notified:
- NewIssue — new issue created
- IssueChangeStatus — issue closed/reopened
- NewPullRequest — new PR opened
- MergePullRequest — PR merged
- NewRelease — new release published
- WorkflowRunStatusUpdate — CI success/failure

Implementation:
- modules/setting/ntfy.go — [ntfy] config section
- services/ntfy/ntfy.go — HTTP POST sender with 5s timeout
- services/ntfy/notifier.go — Notifier implementation (async, non-blocking)

Config:
  [ntfy]
  ENABLED = true
  SERVER_URL = https://ntfy.mokoconsulting.tech
  DEFAULT_TOPIC = mokogitea

Closes #41

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-05-20 20:06:50 -05:00

25 lines
685 B
Go

// Copyright 2026 Moko Consulting <hello@mokoconsulting.tech>
// SPDX-License-Identifier: GPL-3.0-or-later
package setting
// Ntfy holds ntfy push notification settings.
var Ntfy = struct {
Enabled bool
ServerURL string
DefaultTopic string
Token string
}{
Enabled: false,
ServerURL: "https://ntfy.mokoconsulting.tech",
DefaultTopic: "mokogitea",
}
func loadNtfyFrom(cfg ConfigProvider) {
sec := cfg.Section("ntfy")
Ntfy.Enabled = sec.Key("ENABLED").MustBool(false)
Ntfy.ServerURL = sec.Key("SERVER_URL").MustString(Ntfy.ServerURL)
Ntfy.DefaultTopic = sec.Key("DEFAULT_TOPIC").MustString(Ntfy.DefaultTopic)
Ntfy.Token = sec.Key("TOKEN").String()
}