summaryrefslogtreecommitdiff
path: root/main.go
blob: d349903c5e0532d59ff25e268420bee28ca693a8 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
// 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"
	if argv.URL != "" {
		me.urlbase = argv.URL
	}

	me.pollDelay = 3 * time.Second
	me.failcountmax = 20 // die every minute if zookeeper can't be found

	me.machine.ConfigLoad()

	go NewWatchdog()

	startHTTP()
}