Skip to content

Commit

Permalink
feature: ability to split worker and rest api
Browse files Browse the repository at this point in the history
  • Loading branch information
murtll committed Jun 19, 2023
1 parent a519322 commit 23795a5
Showing 1 changed file with 13 additions and 0 deletions.
13 changes: 13 additions & 0 deletions main.go
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,11 @@ import (

func main() {
var health bool
var beatOnly bool
var apiOnly bool
flag.BoolVar(&health, "health", false, "make healthcheck and exit.")
flag.BoolVar(&beatOnly, "beat-only", false, "start only beat worker.")
flag.BoolVar(&apiOnly, "api-only", false, "start only REST API.")
flag.Parse()

if health {
Expand All @@ -25,6 +29,15 @@ func main() {
os.Exit(0)
}

if beatOnly {
worker.Start()
os.Exit(0)
}

if apiOnly {
log.Fatal(rest.Start())
}

go worker.Start()
log.Fatal(rest.Start())
}

0 comments on commit 23795a5

Please sign in to comment.