Limit telemetry and proxy to run command (#5047)
This commit is contained in:
parent
69f6685e4e
commit
ab426a18b7
2 changed files with 19 additions and 9 deletions
19
cmd/root.go
19
cmd/root.go
|
|
@ -15,10 +15,12 @@ import (
|
|||
"github.com/evcc-io/evcc/core"
|
||||
"github.com/evcc-io/evcc/push"
|
||||
"github.com/evcc-io/evcc/server"
|
||||
"github.com/evcc-io/evcc/server/modbus"
|
||||
"github.com/evcc-io/evcc/server/updater"
|
||||
"github.com/evcc-io/evcc/util"
|
||||
"github.com/evcc-io/evcc/util/pipe"
|
||||
"github.com/evcc-io/evcc/util/sponsor"
|
||||
"github.com/evcc-io/evcc/util/telemetry"
|
||||
"github.com/prometheus/client_golang/prometheus/promhttp"
|
||||
|
||||
"github.com/spf13/cobra"
|
||||
|
|
@ -156,6 +158,23 @@ func runRoot(cmd *cobra.Command, args []string) {
|
|||
site, err = configureSiteAndLoadpoints(conf)
|
||||
}
|
||||
|
||||
// setup telemetry
|
||||
if err == nil {
|
||||
telemetry.Create(conf.Plant)
|
||||
if conf.Telemetry {
|
||||
err = telemetry.Enable(true)
|
||||
}
|
||||
}
|
||||
|
||||
// setup modbus proxy
|
||||
if err == nil {
|
||||
for _, cfg := range conf.ModbusProxy {
|
||||
if err = modbus.StartProxy(cfg.Port, cfg.Settings, cfg.ReadOnly); err != nil {
|
||||
break
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// setup database
|
||||
if err == nil && conf.Influx.URL != "" {
|
||||
configureInflux(conf.Influx, site.LoadPoints(), tee.Attach())
|
||||
|
|
|
|||
|
|
@ -27,7 +27,6 @@ import (
|
|||
"github.com/evcc-io/evcc/util/pipe"
|
||||
"github.com/evcc-io/evcc/util/request"
|
||||
"github.com/evcc-io/evcc/util/sponsor"
|
||||
"github.com/evcc-io/evcc/util/telemetry"
|
||||
"github.com/libp2p/zeroconf/v2"
|
||||
"github.com/samber/lo"
|
||||
"github.com/spf13/cobra"
|
||||
|
|
@ -93,14 +92,6 @@ func configureEnvironment(cmd *cobra.Command, conf config) (err error) {
|
|||
err = configureDatabase(conf.Database)
|
||||
}
|
||||
|
||||
// setup telemetry
|
||||
if err == nil {
|
||||
telemetry.Create(conf.Plant)
|
||||
if conf.Telemetry {
|
||||
err = telemetry.Enable(true)
|
||||
}
|
||||
}
|
||||
|
||||
// setup mqtt client listener
|
||||
if err == nil && conf.Mqtt.Broker != "" {
|
||||
err = configureMQTT(conf.Mqtt)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue