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
··· 8 8 "net/http" 9 9 "os" 10 10 "os/signal" 11 + "time" 11 12 12 13 comatproto "github.com/bluesky-social/indigo/api/atproto" 13 14 "github.com/fxamacker/cbor/v2" ··· 102 103 } 103 104 }() 104 105 106 + mux := http.NewServeMux() 107 + mux.HandleFunc("/config", configHandler) 108 + mux.HandleFunc("/", valueHandler) 109 + 110 + srv := &http.Server{ 111 + Addr: "127.0.0.1:4456", 112 + Handler: mux, 113 + } 114 + 115 + go func() { 116 + if err := srv.ListenAndServe(); err != nil { 117 + slog.Error("error starting HTTP server", "err", err) 118 + return 119 + } 120 + }() 121 + 105 122 <-ctx.Done() 106 123 stop() 107 124 slog.Info("shutting down") 108 125 126 + endctx, cancel := context.WithTimeout(context.TODO(), time.Minute) 127 + defer cancel() 128 + 129 + if err := srv.Shutdown(endctx); err != nil { 130 + slog.Error("error shutting down server", "err", err) 131 + } 132 + 109 133 return nil 110 134 } 111 135