Submit brew UUID to dwingest
All checks were successful
continuous-integration/drone/push Build is passing

This commit is contained in:
Søren Rasmussen 2022-08-03 20:09:02 +02:00
parent 1366730593
commit 648996476d
4 changed files with 9 additions and 12 deletions

View file

@ -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

View file

@ -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 {

View file

@ -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"`
}

View file

@ -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"`