summaryrefslogtreecommitdiff
path: root/cmd
diff options
context:
space:
mode:
Diffstat (limited to 'cmd')
-rw-r--r--cmd/redq/main.go11
1 files changed, 10 insertions, 1 deletions
diff --git a/cmd/redq/main.go b/cmd/redq/main.go
index 4514efc..f368dae 100644
--- a/cmd/redq/main.go
+++ b/cmd/redq/main.go
@@ -10,11 +10,13 @@ import (
"github.com/jackc/pgx/v5"
"sinanmohd.com/redq/db"
+ "sinanmohd.com/redq/api"
"sinanmohd.com/redq/usage"
)
func main() {
var u usage.Usage
+ var a api.Api
iface, err := net.InterfaceByName("wlan0")
if err != nil {
@@ -29,17 +31,24 @@ func main() {
defer conn.Close(ctx)
queries := db.New(conn)
+ err = a.Init()
+ if err != nil {
+ os.Exit(0)
+ }
err = u.Init(iface)
if err != nil {
os.Exit(0)
}
+
sigs := make(chan os.Signal, 1)
signal.Notify(sigs, os.Interrupt, os.Kill, syscall.SIGTERM)
go func() {
<-sigs
u.CleanUp(queries, ctx)
+ a.CleanUp()
os.Exit(0)
}()
- u.Run(iface, queries, ctx)
+ go u.Run(iface, queries, ctx)
+ a.Run(&u)
}