load v01 config

master
bel 2023-03-25 00:30:13 -06:00
parent 6289222b69
commit c83f9d8700
3 changed files with 14 additions and 0 deletions

1
go.mod
View File

@ -5,4 +5,5 @@ go 1.19
require (
github.com/go-yaml/yaml v2.1.0+incompatible // indirect
github.com/micmonay/keybd_event v1.1.1 // indirect
gopkg.in/yaml.v2 v2.4.0 // indirect
)

3
go.sum
View File

@ -2,3 +2,6 @@ github.com/go-yaml/yaml v2.1.0+incompatible h1:RYi2hDdss1u4YE7GwixGzWwVo47T8UQwn
github.com/go-yaml/yaml v2.1.0+incompatible/go.mod h1:w2MrLa16VYP0jy6N7M5kHaCkaLENm+P+Tv+MfurjSw0=
github.com/micmonay/keybd_event v1.1.1 h1:rv7omwXWYL9Lgf3PUq6uBgJI2k1yGkL/GD6dxc6nmSs=
github.com/micmonay/keybd_event v1.1.1/go.mod h1:CGMWMDNgsfPljzrAWoybUOSKafQPZpv+rLigt2LzNGI=
gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0=
gopkg.in/yaml.v2 v2.4.0 h1:D8xgwECY7CYvx+Y2n4sBz93Jn9JRvxdiyyo8CTfuKaY=
gopkg.in/yaml.v2 v2.4.0/go.mod h1:RDklbk79AGWmwhnvt/jBztapEOGDOx6ZbXqjP6csGnQ=

View File

@ -2,10 +2,13 @@ package button
import (
"encoding/json"
"io/ioutil"
"log"
"mayhem-party/src/device/input/raw"
"os"
"time"
"gopkg.in/yaml.v2"
)
var debugging = os.Getenv("DEBUG") == "true"
@ -13,6 +16,7 @@ var debugging = os.Getenv("DEBUG") == "true"
type (
V01 struct {
src raw.Raw
cfg v01Cfg
}
v01Msg struct {
T int64
@ -20,11 +24,17 @@ type (
Y string
N string
}
v01Cfg struct {
}
)
func NewV01(src raw.Raw) V01 {
var cfg v01Cfg
b, _ := ioutil.ReadFile(os.Getenv("BUTTON_PARSER_V01_CONFIG"))
yaml.Unmarshal(b, &cfg)
return V01{
src: src,
cfg: cfg,
}
}