feat(daemon): add new subcommand to start a daemon

This commit is contained in:
2019-06-15 15:45:35 +02:00
parent 82faa1d536
commit 5f859139a4
4 changed files with 80 additions and 19 deletions

View File

@ -1,7 +1,11 @@
package daemon
import (
"log"
"github.com/spf13/cobra"
"github.com/volker-raschek/flucky/pkg/config"
"github.com/volker-raschek/flucky/pkg/daemon"
)
var configPath string
@ -11,10 +15,15 @@ var daemonCmd = &cobra.Command{
Short: "Read continuously data from all enabled sensors",
Run: func(cmd *cobra.Command, args []string) {
// read configuration
// cnf, err := config.Read(configPath)
// if err != nil {
// log.Fatalln(err)
// }
cnf, err := config.Read(configPath)
if err != nil {
log.Fatalln(err)
}
err = daemon.Start(cnf)
if err != nil {
panic(err)
}
},
}