Submit brew UUID to dwingest
All checks were successful
continuous-integration/drone/push Build is passing
All checks were successful
continuous-integration/drone/push Build is passing
This commit is contained in:
parent
1366730593
commit
648996476d
4 changed files with 9 additions and 12 deletions
|
@ -13,6 +13,7 @@ import (
|
||||||
"git.joco.dk/sng/fermentord/internal/configuration"
|
"git.joco.dk/sng/fermentord/internal/configuration"
|
||||||
"git.joco.dk/sng/fermentord/pkg/daemon"
|
"git.joco.dk/sng/fermentord/pkg/daemon"
|
||||||
"github.com/getsentry/sentry-go"
|
"github.com/getsentry/sentry-go"
|
||||||
|
"github.com/gofrs/uuid"
|
||||||
"github.com/nats-io/nats.go"
|
"github.com/nats-io/nats.go"
|
||||||
"github.com/prometheus/client_golang/prometheus/promhttp"
|
"github.com/prometheus/client_golang/prometheus/promhttp"
|
||||||
)
|
)
|
||||||
|
@ -32,8 +33,9 @@ func main() {
|
||||||
configuration.Initialize()
|
configuration.Initialize()
|
||||||
config := configuration.LoadConfiguration()
|
config := configuration.LoadConfiguration()
|
||||||
|
|
||||||
if config.Brew.UUID.IsNil() {
|
_, err = uuid.FromString(config.Brew.UUID)
|
||||||
log.Fatal("Brew ID is not configured -- terminating")
|
if err != nil {
|
||||||
|
log.Fatalf("Brew ID is not configured: %v", err)
|
||||||
}
|
}
|
||||||
|
|
||||||
// NATS
|
// NATS
|
||||||
|
|
|
@ -1,13 +1,12 @@
|
||||||
package configuration
|
package configuration
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"github.com/gofrs/uuid"
|
|
||||||
"github.com/spf13/viper"
|
"github.com/spf13/viper"
|
||||||
)
|
)
|
||||||
|
|
||||||
type Configuration struct {
|
type Configuration struct {
|
||||||
Brew struct {
|
Brew struct {
|
||||||
UUID uuid.UUID `mapstructure:"uuid"`
|
UUID string `mapstructure:"uuid"`
|
||||||
} `mapstructure:"brew"`
|
} `mapstructure:"brew"`
|
||||||
|
|
||||||
NATS struct {
|
NATS struct {
|
||||||
|
|
|
@ -2,19 +2,17 @@ package dwingest
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"time"
|
"time"
|
||||||
|
|
||||||
"github.com/gofrs/uuid"
|
|
||||||
)
|
)
|
||||||
|
|
||||||
type State struct {
|
type State struct {
|
||||||
Time time.Time `json:"time"`
|
Time time.Time `json:"time"`
|
||||||
BrewUUID uuid.UUID `json:"brew_uuid"`
|
BrewUUID string `json:"brew_uuid"`
|
||||||
State string `json:"state"`
|
State string `json:"state"`
|
||||||
}
|
}
|
||||||
|
|
||||||
type Tilt struct {
|
type Tilt struct {
|
||||||
Time time.Time `json:"time"`
|
Time time.Time `json:"time"`
|
||||||
BrewUUID uuid.UUID `json:"brew_uuid"`
|
BrewUUID string `json:"brew_uuid"`
|
||||||
Color string `json:"color"`
|
Color string `json:"color"`
|
||||||
Gravity float64 `json:"gravity"`
|
Gravity float64 `json:"gravity"`
|
||||||
Temperature float64 `json:"temperature"`
|
Temperature float64 `json:"temperature"`
|
||||||
|
@ -22,6 +20,6 @@ type Tilt struct {
|
||||||
|
|
||||||
type Event struct {
|
type Event struct {
|
||||||
Time time.Time `json:"time"`
|
Time time.Time `json:"time"`
|
||||||
BrewUUID uuid.UUID `json:"brew_uuid"`
|
BrewUUID string `json:"brew_uuid"`
|
||||||
Event string `json:"event"`
|
Event string `json:"event"`
|
||||||
}
|
}
|
||||||
|
|
|
@ -2,13 +2,11 @@ package temperature
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"time"
|
"time"
|
||||||
|
|
||||||
"github.com/gofrs/uuid"
|
|
||||||
)
|
)
|
||||||
|
|
||||||
type TemperatureReading struct {
|
type TemperatureReading struct {
|
||||||
Time time.Time `json:"time"`
|
Time time.Time `json:"time"`
|
||||||
BrewUUID uuid.UUID `json:"brew_uuid"`
|
BrewUUID string `json:"brew_uuid"`
|
||||||
Ambient float64 `json:"ambient"`
|
Ambient float64 `json:"ambient"`
|
||||||
Chamber float64 `json:"chamber"`
|
Chamber float64 `json:"chamber"`
|
||||||
Wort float64 `json:"wort"`
|
Wort float64 `json:"wort"`
|
||||||
|
|
Loading…
Reference in a new issue