Fix: route log name

Signed-off-by: Knut Ahlers <knut@ahlers.me>
This commit is contained in:
Knut Ahlers 2021-09-22 21:02:08 +02:00
parent dd4203c187
commit 43f06322f2
Signed by: luzifer
GPG key ID: 0066F03ED215AD7D
2 changed files with 5 additions and 5 deletions

2
api.go
View file

@ -140,7 +140,7 @@ func registerAPI(r *mux.Router) {
r.HandleFunc("/api/follows/set-last/{name}", handleSetLastFollower).Methods(http.MethodPut) r.HandleFunc("/api/follows/set-last/{name}", handleSetLastFollower).Methods(http.MethodPut)
r.HandleFunc("/api/subscribe", handleUpdateSocket).Methods(http.MethodGet) r.HandleFunc("/api/subscribe", handleUpdateSocket).Methods(http.MethodGet)
r.HandleFunc("/api/webhook/{type}", handleWebHookPush) r.HandleFunc("/api/webhook/{type}", handleWebHookPush)
r.HandleFunc("/api/eventsys", handleEventsubPush) r.HandleFunc("/api/eventsub", handleEventsubPush)
} }
func handleCustomAlert(w http.ResponseWriter, r *http.Request) { func handleCustomAlert(w http.ResponseWriter, r *http.Request) {

View file

@ -98,7 +98,7 @@ func handleEventsubPush(w http.ResponseWriter, r *http.Request) {
// Read message // Read message
if err := json.NewDecoder(body).Decode(&message); err != nil { if err := json.NewDecoder(body).Decode(&message); err != nil {
log.WithError(err).Errorf("Unable to decode eventsys message") log.WithError(err).Errorf("Unable to decode eventsub message")
http.Error(w, errors.Wrap(err, "parsing message").Error(), http.StatusBadRequest) http.Error(w, errors.Wrap(err, "parsing message").Error(), http.StatusBadRequest)
return return
} }
@ -123,7 +123,7 @@ func handleEventsubPush(w http.ResponseWriter, r *http.Request) {
case "channel.follow": case "channel.follow":
var evt eventSubEventFollow var evt eventSubEventFollow
if err := json.Unmarshal(message.Event, &evt); err != nil { if err := json.Unmarshal(message.Event, &evt); err != nil {
log.WithError(err).Errorf("Unable to decode eventsys event payload") log.WithError(err).Errorf("Unable to decode eventsub event payload")
http.Error(w, errors.Wrap(err, "parsing message").Error(), http.StatusBadRequest) http.Error(w, errors.Wrap(err, "parsing message").Error(), http.StatusBadRequest)
return return
} }
@ -177,7 +177,7 @@ func handleEventsubPush(w http.ResponseWriter, r *http.Request) {
func registerEventSubHooks() error { func registerEventSubHooks() error {
hookURL := strings.Join([]string{ hookURL := strings.Join([]string{
strings.TrimRight(cfg.BaseURL, "/"), strings.TrimRight(cfg.BaseURL, "/"),
"api", "eventsys", "api", "eventsub",
}, "/") }, "/")
ctx, cancel := context.WithTimeout(context.Background(), twitchRequestTimeout) ctx, cancel := context.WithTimeout(context.Background(), twitchRequestTimeout)
@ -274,7 +274,7 @@ func registerEventSubHooks() error {
return errors.Errorf("unexpected status %d: %s", resp.StatusCode, body) return errors.Errorf("unexpected status %d: %s", resp.StatusCode, body)
} }
logger.Debug("Registered eventsys subscription") logger.Debug("Registered eventsub subscription")
} }
return nil return nil