summaryrefslogtreecommitdiff
path: root/template/main.go
diff options
context:
space:
mode:
Diffstat (limited to 'template/main.go')
-rw-r--r--template/main.go15
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
}
}