webhooks support (#81)
This commit is contained in:
@@ -6,6 +6,8 @@ import (
|
||||
|
||||
"github.com/go-redis/redis/v8"
|
||||
"github.com/google/wire"
|
||||
"github.com/livekit/protocol/auth"
|
||||
"github.com/livekit/protocol/webhook"
|
||||
"github.com/pkg/errors"
|
||||
|
||||
"github.com/livekit/livekit-server/pkg/config"
|
||||
@@ -18,6 +20,7 @@ var ServiceSet = wire.NewSet(
|
||||
createRedisClient,
|
||||
createRouter,
|
||||
createStore,
|
||||
createWebhookNotifier,
|
||||
NewRecordingService,
|
||||
NewRoomService,
|
||||
NewRTCService,
|
||||
@@ -66,6 +69,19 @@ func createStore(rc *redis.Client) RoomStore {
|
||||
return NewLocalRoomStore()
|
||||
}
|
||||
|
||||
func createWebhookNotifier(conf *config.Config, provider auth.KeyProvider) (*webhook.Notifier, error) {
|
||||
wc := conf.WebHook
|
||||
if len(wc.URLs) == 0 {
|
||||
return nil, nil
|
||||
}
|
||||
secret := provider.GetSecret(wc.APIKey)
|
||||
if secret == "" {
|
||||
return nil, ErrWebHookMissingAPIKey
|
||||
}
|
||||
|
||||
return webhook.NewNotifier(wc.APIKey, secret, wc.URLs), nil
|
||||
}
|
||||
|
||||
func handleError(w http.ResponseWriter, status int, msg string) {
|
||||
// GetLogger already with extra depth 1
|
||||
logger.GetLogger().V(1).Info("error handling request", "error", msg, "status", status)
|
||||
|
||||
Reference in New Issue
Block a user