diff options
author | Elizabeth Hunt <elizabeth.hunt@simponic.xyz> | 2025-01-05 16:36:51 -0800 |
---|---|---|
committer | Elizabeth Hunt <elizabeth.hunt@simponic.xyz> | 2025-01-11 11:58:34 -0800 |
commit | 040994898b109b3f344b37d1d449eb3b8f58ec53 (patch) | |
tree | 04758f61df0034a398ba133a3b29e7feecf23b85 /template/main.go | |
parent | 687caaa787f9114e390ef34cd06b0c0658cdeae2 (diff) | |
download | oldinfra-040994898b109b3f344b37d1d449eb3b8f58ec53.tar.gz oldinfra-040994898b109b3f344b37d1d449eb3b8f58ec53.zip |
add ntfy integration
Diffstat (limited to 'template/main.go')
-rw-r--r-- | template/main.go | 15 |
1 files changed, 14 insertions, 1 deletions
diff --git a/template/main.go b/template/main.go index 6d2b657..3ddb39c 100644 --- a/template/main.go +++ b/template/main.go @@ -9,6 +9,7 @@ import ( "{{ service_repo }}/args" "{{ service_repo }}/database" "{{ service_repo }}/scheduler" + "{{ service_repo }}/ntfy" "github.com/joho/godotenv" ) @@ -36,6 +37,18 @@ func main() { log.Println("database migrated successfully") } + if argv.NtfyListener { + ntfy := ntfy.MakeNtfyWatcher(argv.NtfyEndpoint, argv.NtfyTopics) + notifications := ntfy.Watch() + + go func() { + for notification := range notifications { + message := notification.Message + log.Println("got message", message) + } + }() + } + if argv.Scheduler { go func() { scheduler.StartScheduler(dbConn, argv) @@ -57,7 +70,7 @@ func main() { }() } - if argv.Server || argv.Scheduler { + if argv.Server || argv.Scheduler || argv.NtfyListener { select {} // block forever } } |