/
main.go
43 lines (36 loc) · 900 Bytes
/
main.go
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
package main
import (
"log"
)
var (
config Config
apiServer APIServer
metrics Metrics
isTesting bool = false // flag used when testing
)
func main() {
log.Println("Starting: Terrarium bot")
config = config.Load()
if config.Debug {
log.Println("****************************************")
log.Println("**** Debug mode currently active! ****")
log.Println("**** There will be extra log output ****")
log.Println("****************************************")
}
if config.DryRun {
log.Println("****************************************")
log.Println("**** Dry run mode currently active! ****")
log.Println("**** No switches will be flipped! ****")
log.Println("****************************************")
}
InitSensors()
InitSwitches()
InitTime()
InitAlerting()
apiServer.Start()
metrics.Start()
InitTriggers()
InitNotifications()
// don't die
select {}
}