fix: remove obsolete attributes from config.json
changes: - removed unused attributes from config.json
This commit is contained in:
14
cli/root.go
14
cli/root.go
@ -11,7 +11,6 @@ import (
|
||||
"git.cryptic.systems/volker.raschek/flucky/cli/daemon"
|
||||
"git.cryptic.systems/volker.raschek/flucky/cli/sensor"
|
||||
"git.cryptic.systems/volker.raschek/flucky/pkg/config"
|
||||
"git.cryptic.systems/volker.raschek/flucky/pkg/types"
|
||||
"github.com/Masterminds/semver"
|
||||
|
||||
uuid "github.com/satori/go.uuid"
|
||||
@ -62,11 +61,6 @@ func preRunError(cmd *cobra.Command, args []string) error {
|
||||
// check if config file exists
|
||||
if _, err := os.Stat(configFile); os.IsNotExist(err) {
|
||||
|
||||
hostname, err := os.Hostname()
|
||||
if err != nil {
|
||||
return fmt.Errorf("Failed to determine the hostname: %v", err)
|
||||
}
|
||||
|
||||
// Time must be truncted for postgres. Postgres currently does not support
|
||||
// nanoseconds which is automatically include into the go time object
|
||||
postgresTimeStamp := time.Now()
|
||||
@ -85,12 +79,8 @@ func preRunError(cmd *cobra.Command, args []string) error {
|
||||
// Default configuration
|
||||
dsn := fmt.Sprintf("sqlite3://%v/sqlite.db?cache=shared&mode=memory&foreign_keys=on", defaultCacheDir)
|
||||
cnf := config.Config{
|
||||
Device: &types.Device{
|
||||
ID: uuid.NewV4().String(),
|
||||
Name: hostname,
|
||||
CreationDate: postgresTimeStamp,
|
||||
},
|
||||
DSN: dsn,
|
||||
DeviceID: uuid.NewV4().String(),
|
||||
DSN: dsn,
|
||||
}
|
||||
|
||||
err = config.Write(&cnf, configFile)
|
||||
|
@ -164,7 +164,7 @@ func addSensor(cmd *cobra.Command, args []string) error {
|
||||
return err
|
||||
}
|
||||
|
||||
sensor.DeviceID = cnf.Device.ID
|
||||
sensor.DeviceID = cnf.DeviceID
|
||||
|
||||
dsnURL, err := url.Parse(cnf.DSN)
|
||||
if err != nil {
|
||||
@ -292,7 +292,7 @@ func listSensors(cmd *cobra.Command, args []string) error {
|
||||
}
|
||||
|
||||
// add sensor entry to list
|
||||
sensors, err := repo.GetSensorsByDeviceID(cnf.Device.ID)
|
||||
sensors, err := repo.GetSensorsByDeviceID(cnf.DeviceID)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
Reference in New Issue
Block a user