datawriter/cmd/shell/main.go

41 lines
702 B
Go

package main
import (
"context"
"fmt"
"os"
"os/signal"
"sync"
"syscall"
"gittea.marcokittel.de/elio/eliotools/datawriter/internal/app"
"gittea.marcokittel.de/elio/eliotools/datawriter/internal/dataservice"
)
const (
NewDir = "/new"
ProcessedDir = "/processed"
Rights = 0755
StockMustHaveFileLen = 38
)
func main() {
a, _ := os.Getwd()
fmt.Printf("%s\n", a)
ctx, cancel := signal.NotifyContext(
context.Background(),
os.Interrupt,
syscall.SIGTERM,
)
defer cancel()
var wg sync.WaitGroup
app := app.NewApp(&wg)
ds := dataservice.NewDataService()
ds.AddListener(app)
wg.Add(ds.ListenerCount())
app.Run()
ds.Run(ctx, &wg)
wg.Wait()
}