diff --git a/cmd/fermentord/main.go b/cmd/fermentord/main.go index b9af318..2efb70e 100644 --- a/cmd/fermentord/main.go +++ b/cmd/fermentord/main.go @@ -13,6 +13,7 @@ import ( "git.joco.dk/sng/fermentord/internal/configuration" "git.joco.dk/sng/fermentord/pkg/daemon" "github.com/getsentry/sentry-go" + "github.com/gofrs/uuid" "github.com/nats-io/nats.go" "github.com/prometheus/client_golang/prometheus/promhttp" ) @@ -32,8 +33,9 @@ func main() { configuration.Initialize() config := configuration.LoadConfiguration() - if config.Brew.UUID.IsNil() { - log.Fatal("Brew ID is not configured -- terminating") + _, err = uuid.FromString(config.Brew.UUID) + if err != nil { + log.Fatalf("Brew ID is not configured: %v", err) } // NATS diff --git a/internal/configuration/global.go b/internal/configuration/global.go index f9f7d07..db52d68 100644 --- a/internal/configuration/global.go +++ b/internal/configuration/global.go @@ -1,13 +1,12 @@ package configuration import ( - "github.com/gofrs/uuid" "github.com/spf13/viper" ) type Configuration struct { Brew struct { - UUID uuid.UUID `mapstructure:"uuid"` + UUID string `mapstructure:"uuid"` } `mapstructure:"brew"` NATS struct { diff --git a/internal/dwingest/types.go b/internal/dwingest/types.go index 90b2288..47464b5 100644 --- a/internal/dwingest/types.go +++ b/internal/dwingest/types.go @@ -2,19 +2,17 @@ package dwingest import ( "time" - - "github.com/gofrs/uuid" ) type State struct { Time time.Time `json:"time"` - BrewUUID uuid.UUID `json:"brew_uuid"` + BrewUUID string `json:"brew_uuid"` State string `json:"state"` } type Tilt struct { Time time.Time `json:"time"` - BrewUUID uuid.UUID `json:"brew_uuid"` + BrewUUID string `json:"brew_uuid"` Color string `json:"color"` Gravity float64 `json:"gravity"` Temperature float64 `json:"temperature"` @@ -22,6 +20,6 @@ type Tilt struct { type Event struct { Time time.Time `json:"time"` - BrewUUID uuid.UUID `json:"brew_uuid"` + BrewUUID string `json:"brew_uuid"` Event string `json:"event"` } diff --git a/pkg/temperature/temperature.go b/pkg/temperature/temperature.go index f99d330..c5715e2 100644 --- a/pkg/temperature/temperature.go +++ b/pkg/temperature/temperature.go @@ -2,13 +2,11 @@ package temperature import ( "time" - - "github.com/gofrs/uuid" ) type TemperatureReading struct { Time time.Time `json:"time"` - BrewUUID uuid.UUID `json:"brew_uuid"` + BrewUUID string `json:"brew_uuid"` Ambient float64 `json:"ambient"` Chamber float64 `json:"chamber"` Wort float64 `json:"wort"`