ADd consul support , multiple monitors, config file
This commit is contained in:
14
main.go
14
main.go
@@ -3,27 +3,23 @@ package main
|
||||
import (
|
||||
"context"
|
||||
"flag"
|
||||
c "github.com/mayuresh82/gocast/config"
|
||||
"github.com/mayuresh82/gocast/controller"
|
||||
"github.com/mayuresh82/gocast/server"
|
||||
"os"
|
||||
"os/signal"
|
||||
"syscall"
|
||||
"time"
|
||||
)
|
||||
|
||||
var (
|
||||
serverAddr = flag.String("serverAddr", ":8080", "Addr for http service")
|
||||
localAS = flag.Int("localAS", 65000, "Local ASN of the gocast host")
|
||||
peerAS = flag.Int("peerAS", 65254, "AS to peer with")
|
||||
monitorInterval = flag.Duration("monitorInterval", 5*time.Second, "Interval for health check")
|
||||
peerIP = flag.String("peerIP", "", "Override the IP to peer with. Default: gateway ip")
|
||||
cleanupTimer = flag.Duration("cleanup", 15*time.Minute, "Time to flush out inactive apps")
|
||||
config = flag.String("config", "", "Path to config file")
|
||||
)
|
||||
|
||||
func main() {
|
||||
flag.Parse()
|
||||
mon := controller.NewMonitor(*localAS, *peerAS, *monitorInterval, *peerIP, *cleanupTimer)
|
||||
srv := server.NewServer(*serverAddr, mon)
|
||||
conf := c.GetConfig(*config)
|
||||
mon := controller.NewMonitor(conf)
|
||||
srv := server.NewServer(conf.Agent.ListenAddr, mon)
|
||||
|
||||
ctx, cancel := context.WithCancel(context.Background())
|
||||
// catch interrupt
|
||||
|
||||
Reference in New Issue
Block a user