this repo has no description

Compare changes

Choose any two refs to compare.

Changed files
+24
cmd
bsky-modactions
+24
cmd/bsky-modactions/main.go
···
"net/http"
"os"
"os/signal"
+
"time"
comatproto "github.com/bluesky-social/indigo/api/atproto"
"github.com/fxamacker/cbor/v2"
···
}
}()
+
mux := http.NewServeMux()
+
mux.HandleFunc("/config", configHandler)
+
mux.HandleFunc("/", valueHandler)
+
+
srv := &http.Server{
+
Addr: "127.0.0.1:4456",
+
Handler: mux,
+
}
+
+
go func() {
+
if err := srv.ListenAndServe(); err != nil {
+
slog.Error("error starting HTTP server", "err", err)
+
return
+
}
+
}()
+
<-ctx.Done()
stop()
slog.Info("shutting down")
+
endctx, cancel := context.WithTimeout(context.TODO(), time.Minute)
+
defer cancel()
+
+
if err := srv.Shutdown(endctx); err != nil {
+
slog.Error("error shutting down server", "err", err)
+
}
+
return nil
}