fix(pkg/daemon): save measured values into postgres database if defined

This commit is contained in:
2019-09-04 13:37:50 +02:00
parent 6223f4e79b
commit 04bc3baffe
60 changed files with 680 additions and 378 deletions

View File

@ -5,7 +5,8 @@ import (
"log"
"github.com/Masterminds/semver"
database "github.com/go-flucky/flucky/pkg/db"
"github.com/go-flucky/flucky/pkg/config"
database "github.com/go-flucky/flucky/pkg/storage/db"
"github.com/go-flucky/flucky/pkg/types"
"github.com/spf13/cobra"
)
@ -21,7 +22,13 @@ var dbCmd = &cobra.Command{
Short: "Operates with the configured database",
Run: func(cmd *cobra.Command, args []string) {
postgresDB, err := database.New(database.DBOTypePostgres, "localhost", "5432", "postgres", "postgres", "postgres")
// read configuration
cnf, err := config.Read(*configFile)
if err != nil {
log.Fatalln(err)
}
postgresDB, err := database.New(cnf.DatabaseSettings)
if err != nil {
log.Fatalf("%v", err)
}