package main import ( "flag" "fmt" "git.gammaspectra.live/S.O.N.G/MeteorLight/api" "git.gammaspectra.live/S.O.N.G/MeteorLight/config" "git.gammaspectra.live/S.O.N.G/MeteorLight/queue" "log" "net/http" "sync" "time" ) func main() { configPath := flag.String("config", "config.toml", "Config path") flag.Parse() conf, err := config.GetConfig(*configPath) if err != nil { log.Panic(err) } var wg sync.WaitGroup queueInstance := queue.NewQueue(conf) wg.Add(1) go func() { defer wg.Done() server := http.Server{ Addr: fmt.Sprintf("%s:%d", conf.Radio.Host, conf.Radio.Port), Handler: http.HandlerFunc(queueInstance.HandleRadioRequest), ReadTimeout: time.Second * 5, } if err = server.ListenAndServe(); err != nil { log.Panic(err) } }() apiInstance := api.NewAPI(conf, queueInstance) apiInstance.Wait() wg.Wait() queueInstance.Wait() }