// Copyright 2017-2025 WIT.COM Inc. All rights reserved. // Use of this source code is governed by the GPL 3.0 package main import ( "embed" "os" "time" "go.wit.com/dev/alexflint/arg" "go.wit.com/gui" "go.wit.com/lib/protobuf/zoopb" "go.wit.com/log" ) var VERSION string var BUILDTIME string //go:embed resources/* var resources embed.FS func main() { log.Warn("zookeeper PID:", os.Getpid(), os.Args) var pp *arg.Parser gui.InitArg() // include the 'gui' package command line arguements pp = arg.MustParse(&argv) // parse the command line if pp == nil { pp.WriteHelp(os.Stdout) os.Exit(0) } // check if the binary is being called to test // if the plugin can actually loaded. This is a hack // around needing a Test() plugin load function in GO if gui.IsGoPluginTestHack() { argv.NoPort = true gui.CheckPlugin() os.Exit(0) // if argv.GuiCheck != "" { // } } if argv.Daemon { // turn off timestamps for STDOUT (systemd adds them) log.DaemonMode(true) } me = new(zookeep) me.hostname, _ = os.Hostname() me.pollDelay = time.Hour me.machines = zoopb.NewMachines() if err := me.machines.ConfigLoad(); err != nil { log.Warn("load config failed", err) os.Exit(-1) } // me.upgrade = make(map[string]bool) // used to trigger upgrade attempts // log.Sleep(3) go NewWatchdog() if !argv.NoPort { go startHTTP() } doGui() }