fix nil ref
This commit is contained in:
parent
21de378fbc
commit
599c4861a6
|
@ -16,7 +16,7 @@ func failOnError(err error, msg string) {
|
||||||
|
|
||||||
func main() {
|
func main() {
|
||||||
|
|
||||||
amqpConn := AMQPConnection{}
|
amqpConn := new(AMQPConnection)
|
||||||
amqpConn.Init()
|
amqpConn.Init()
|
||||||
err := amqpConn.Connect()
|
err := amqpConn.Connect()
|
||||||
defer amqpConn.Close()
|
defer amqpConn.Close()
|
||||||
|
@ -30,7 +30,7 @@ func main() {
|
||||||
fmt.Println("InfluxDB token:")
|
fmt.Println("InfluxDB token:")
|
||||||
fmt.Println(strings.TrimSpace(string(influx_token)))
|
fmt.Println(strings.TrimSpace(string(influx_token)))
|
||||||
|
|
||||||
influx := InfluxWriter{}
|
influx := new(InfluxWriter)
|
||||||
influx.Init(
|
influx.Init(
|
||||||
os.Getenv("INFLUX_URL"),
|
os.Getenv("INFLUX_URL"),
|
||||||
strings.TrimSpace(string(influx_token)),
|
strings.TrimSpace(string(influx_token)),
|
||||||
|
@ -53,10 +53,10 @@ func main() {
|
||||||
var forever chan struct{}
|
var forever chan struct{}
|
||||||
|
|
||||||
shellPipe := new(Piper)
|
shellPipe := new(Piper)
|
||||||
shellPipe.Start(&influx, &amqpConn, "shelly", "shellies.#", ShellyConverter)
|
shellPipe.Start(influx, amqpConn, "shelly", "shellies.#", ShellyConverter)
|
||||||
|
|
||||||
tasmotaPipe := new(Piper)
|
tasmotaPipe := new(Piper)
|
||||||
tasmotaPipe.Start(&influx, &amqpConn, "tasmota", "tele.#.SENSOR", TasmotaConverter)
|
tasmotaPipe.Start(influx, amqpConn, "tasmota", "tele.#.SENSOR", TasmotaConverter)
|
||||||
|
|
||||||
log.Printf(" [*] Waiting for logs. To exit press CTRL+C")
|
log.Printf(" [*] Waiting for logs. To exit press CTRL+C")
|
||||||
<-forever
|
<-forever
|
||||||
|
|
|
@ -20,6 +20,7 @@ func (p *Piper) Start(
|
||||||
// Create a new client using an InfluxDB server base URL and an authentication token
|
// Create a new client using an InfluxDB server base URL and an authentication token
|
||||||
p.influx = writer
|
p.influx = writer
|
||||||
p.delivery, _ = amqp.ConnectToQueue(queue_name, routing_key)
|
p.delivery, _ = amqp.ConnectToQueue(queue_name, routing_key)
|
||||||
|
p.conversion = conversion
|
||||||
|
|
||||||
notify := amqp.NotifyError()
|
notify := amqp.NotifyError()
|
||||||
go func() {
|
go func() {
|
||||||
|
|
Loading…
Reference in New Issue