38 lines
682 B
Go
38 lines
682 B
Go
package main
|
|
|
|
import (
|
|
"context"
|
|
"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() {
|
|
ctx, cancel := signal.NotifyContext(
|
|
context.Background(),
|
|
os.Interrupt,
|
|
syscall.SIGTERM,
|
|
)
|
|
|
|
defer cancel()
|
|
var wg sync.WaitGroup
|
|
app := app.NewApp(NewDir, ProcessedDir, Rights, &wg)
|
|
ds := dataservice.NewDataService()
|
|
ds.AddListener(app)
|
|
wg.Add(ds.ListenerCount())
|
|
app.Run()
|
|
ds.Run(ctx, &wg)
|
|
wg.Wait()
|
|
}
|