2024-11-18 20:22:12 -06:00
|
|
|
// Copyright 2024 WIT.COM Inc.
|
2024-11-15 01:22:47 -06:00
|
|
|
|
|
|
|
package main
|
|
|
|
|
|
|
|
import (
|
|
|
|
"embed"
|
|
|
|
"os"
|
2024-11-15 09:12:08 -06:00
|
|
|
"time"
|
2024-11-15 01:22:47 -06:00
|
|
|
|
|
|
|
"go.wit.com/dev/alexflint/arg"
|
|
|
|
"go.wit.com/log"
|
|
|
|
)
|
|
|
|
|
|
|
|
var VERSION string
|
2024-11-15 13:40:07 -06:00
|
|
|
var BUILDTIME string
|
2024-11-15 01:22:47 -06:00
|
|
|
|
|
|
|
//go:embed resources/*
|
|
|
|
var resources embed.FS
|
|
|
|
|
|
|
|
func main() {
|
|
|
|
var pp *arg.Parser
|
|
|
|
pp = arg.MustParse(&argv)
|
|
|
|
|
|
|
|
if pp == nil {
|
|
|
|
pp.WriteHelp(os.Stdout)
|
|
|
|
os.Exit(0)
|
|
|
|
}
|
|
|
|
|
2024-11-15 18:11:52 -06:00
|
|
|
if argv.Daemon {
|
|
|
|
// turn off timestamps for STDOUT (systemd adds them)
|
|
|
|
log.DaemonMode(true)
|
2024-11-15 01:22:47 -06:00
|
|
|
}
|
2024-11-15 09:50:13 -06:00
|
|
|
|
2024-11-15 18:11:52 -06:00
|
|
|
me = new(stuff)
|
2024-11-18 20:22:12 -06:00
|
|
|
me.urlbase = "http://zookeeper.grid.wit.com:8080"
|
|
|
|
|
2024-11-15 18:11:52 -06:00
|
|
|
me.pollDelay = 3 * time.Second
|
2024-11-18 20:22:12 -06:00
|
|
|
me.failcountmax = 20 // die every minute if zookeeper can't be found
|
2024-11-15 09:50:13 -06:00
|
|
|
|
2024-11-21 19:48:09 -06:00
|
|
|
me.machine.ConfigLoad()
|
2024-11-15 09:50:13 -06:00
|
|
|
|
2024-11-15 09:12:08 -06:00
|
|
|
go NewWatchdog()
|
2024-11-15 01:22:47 -06:00
|
|
|
|
|
|
|
startHTTP()
|
|
|
|
}
|