forked from checkmarble/marble-backend
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmain.go
77 lines (67 loc) · 1.95 KB
/
main.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
package main
import (
"flag"
"log"
"log/slog"
"github.com/checkmarble/marble-backend/cmd"
"github.com/checkmarble/marble-backend/utils"
)
func main() {
shouldRunMigrations := flag.Bool("migrations", false, "Run migrations")
shouldRunServer := flag.Bool("server", false, "Run server")
shouldRunScheduleScenarios := flag.Bool("scheduler", false, "Run schedule scenarios")
shouldRunExecuteScheduledScenarios := flag.Bool("scheduled-executer", false, "Run execute scheduled scenarios")
shouldRunDataIngestion := flag.Bool("data-ingestion", false, "Run data ingestion")
shouldRunSendPendingWebhookEvents := flag.Bool("send-pending-webhook-events", false, "Send pending webhook events")
shouldRunScheduler := flag.Bool("cron-scheduler", false, "Run scheduler for cron jobs")
flag.Parse()
utils.NewLogger("text").Info("Flags",
slog.Bool("shouldRunMigrations", *shouldRunMigrations),
slog.Bool("shouldRunServer", *shouldRunServer),
slog.Bool("shouldRunScheduledScenarios", *shouldRunScheduleScenarios),
slog.Bool("shouldRunDataIngestion", *shouldRunDataIngestion),
slog.Bool("shouldRunScheduler", *shouldRunScheduler),
slog.Bool("shouldRunSendPendingWebhookEvents", *shouldRunSendPendingWebhookEvents),
)
if *shouldRunMigrations {
if err := cmd.RunMigrations(); err != nil {
log.Fatal(err)
}
}
if *shouldRunServer {
err := cmd.RunServer()
if err != nil {
log.Fatal(err)
}
}
if *shouldRunScheduleScenarios {
err := cmd.RunScheduleScenarios()
if err != nil {
log.Fatal(err)
}
}
if *shouldRunExecuteScheduledScenarios {
err := cmd.RunScheduledExecuter()
if err != nil {
log.Fatal(err)
}
}
if *shouldRunDataIngestion {
err := cmd.RunBatchIngestion()
if err != nil {
log.Fatal(err)
}
}
if *shouldRunSendPendingWebhookEvents {
err := cmd.RunSendPendingWebhookEvents()
if err != nil {
log.Fatal(err)
}
}
if *shouldRunScheduler {
err := cmd.RunJobScheduler()
if err != nil {
log.Fatal(err)
}
}
}