35 lines
437 B
Go
35 lines
437 B
Go
package main
|
|
|
|
import (
|
|
"mqttListener/Config"
|
|
"mqttListener/mqtt"
|
|
|
|
//"mqttListener/cmd"
|
|
|
|
//"fmt"
|
|
"os"
|
|
"os/signal"
|
|
"syscall"
|
|
)
|
|
|
|
func main() {
|
|
|
|
c := make(chan os.Signal, 1)
|
|
signal.Notify(c, os.Interrupt, syscall.SIGTERM)
|
|
|
|
Config.ReadConfig()
|
|
|
|
// DEBUG Config
|
|
// fmt.Println("BrokerAddress = ", Config.BrokerAddress)
|
|
|
|
mqtt.Setup()
|
|
mqtt.Connect()
|
|
go mqtt.Listen()
|
|
|
|
//cmd.Exec()
|
|
|
|
<-c // wait for SIGTERM
|
|
|
|
mqtt.Disconnect()
|
|
}
|