mirror of
https://github.com/taigrr/github-to-signal.git
synced 2026-04-02 03:09:09 -07:00
HTTP server that receives GitHub webhook events and sends formatted notifications to Signal via signal-cli's JSON-RPC API. Supported events: push, issues, issue comments, pull requests, PR reviews, PR review comments, releases, stars, forks, workflow runs, branch/tag creation, branch/tag deletion. Uses cbrgm/githubevents for webhook handling and taigrr/signalcli for Signal delivery. Config via TOML file or GH2SIG_ env vars (powered by taigrr/jety).
36 lines
1.0 KiB
Go
36 lines
1.0 KiB
Go
package main
|
|
|
|
import "github.com/taigrr/jety"
|
|
|
|
// Config holds the application configuration.
|
|
type Config struct {
|
|
// ListenAddr is the address to bind the webhook server to.
|
|
ListenAddr string
|
|
// WebhookSecret is the GitHub webhook secret for signature validation.
|
|
WebhookSecret string
|
|
// SignalURL is the signal-cli JSON-RPC base URL.
|
|
SignalURL string
|
|
// SignalAccount is the signal-cli account (phone number or UUID).
|
|
SignalAccount string
|
|
// SignalRecipient is the default Signal recipient for notifications.
|
|
SignalRecipient string
|
|
}
|
|
|
|
func loadConfig() Config {
|
|
jety.SetDefault("listen_addr", ":9900")
|
|
jety.SetDefault("signal_url", "http://127.0.0.1:8080")
|
|
|
|
jety.SetEnvPrefix("GH2SIG")
|
|
jety.SetConfigFile("config.toml")
|
|
jety.SetConfigType("toml")
|
|
_ = jety.ReadInConfig()
|
|
|
|
return Config{
|
|
ListenAddr: jety.GetString("listen_addr"),
|
|
WebhookSecret: jety.GetString("webhook_secret"),
|
|
SignalURL: jety.GetString("signal_url"),
|
|
SignalAccount: jety.GetString("signal_account"),
|
|
SignalRecipient: jety.GetString("signal_recipient"),
|
|
}
|
|
}
|