-
Notifications
You must be signed in to change notification settings - Fork 2
/
main.go
54 lines (45 loc) · 880 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
44
45
46
47
48
49
50
51
52
53
54
package main
import (
"time"
"MqttCommander/Automation"
"MqttCommander/Config"
"MqttCommander/Cron"
"MqttCommander/Dashbaord"
"MqttCommander/Http"
"MqttCommander/Mqtt"
"MqttCommander/Rule"
log "github.com/sirupsen/logrus"
)
func main() {
// Setup Logger
log.SetFormatter(&log.TextFormatter{
FullTimestamp: true,
})
log.SetLevel(log.DebugLevel)
log.Info("[MAIN] Welcome to MqttCommader! By Calvin Köcher 2022 [[email protected]]")
// Setup
Config.Begin()
Config.ReadConfig()
Automation.Begin()
Rule.Begin()
Dashbaord.Begin()
Mqtt.Begin()
Cron.Begin()
Http.Begin()
// Watch Changes
go func() {
for {
if Automation.Read(Config.Get().ConfigPath) > 0 {
Automation.Deploy()
Mqtt.Deploy()
Cron.Deploy()
Http.Deploy()
}
time.Sleep(1 * time.Second)
}
}()
// Forever
for {
time.Sleep(time.Second)
}
}