46 lines
674 B
Go
46 lines
674 B
Go
// Copyright 2024 WIT.COM Inc.
|
|
|
|
package main
|
|
|
|
import (
|
|
"embed"
|
|
"os"
|
|
"time"
|
|
|
|
"go.wit.com/dev/alexflint/arg"
|
|
"go.wit.com/log"
|
|
)
|
|
|
|
var VERSION string
|
|
var BUILDTIME string
|
|
|
|
//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)
|
|
}
|
|
|
|
if argv.Daemon {
|
|
// turn off timestamps for STDOUT (systemd adds them)
|
|
log.DaemonMode(true)
|
|
}
|
|
|
|
me = new(stuff)
|
|
me.urlbase = "http://zookeeper.grid.wit.com:8080"
|
|
|
|
me.pollDelay = 3 * time.Second
|
|
me.failcountmax = 20 // die every minute if zookeeper can't be found
|
|
|
|
me.machine.ConfigLoad()
|
|
|
|
go NewWatchdog()
|
|
|
|
startHTTP()
|
|
}
|