$OUTPUT_KEYBOARD=true

master
Bel LaPointe 2023-03-02 09:54:38 -07:00
parent 594bc39470
commit 78a5445679
3 changed files with 7 additions and 0 deletions

View File

@ -2,6 +2,7 @@ package main
import (
"context"
"log"
"mayhem-party/src"
"os/signal"
"syscall"
@ -13,4 +14,5 @@ func main() {
if err := src.Main(ctx); err != nil && ctx.Err() == nil {
panic(err)
}
log.Printf("shutdown")
}

View File

@ -11,5 +11,8 @@ type Output interface {
}
func New() Output {
if os.Getenv("OUTPUT_KEYBOARD") == "true" {
return NewKeyboard()
}
return NewWriter(os.Stderr)
}

View File

@ -12,6 +12,8 @@ import (
func Main(ctx context.Context) error {
reader := input.New()
writer := output.New()
defer writer.Close()
interval := time.Millisecond * 50
if intervalS, ok := os.LookupEnv("MAIN_INTERVAL_DURATION"); !ok {
} else if v, err := time.ParseDuration(intervalS); err != nil {