feat: add helper for updating all users
This commit is contained in:
@@ -11,6 +11,7 @@ import (
|
||||
"github.com/authorizerdev/authorizer/server/constants"
|
||||
"github.com/authorizerdev/authorizer/server/db"
|
||||
"github.com/authorizerdev/authorizer/server/db/models"
|
||||
"github.com/authorizerdev/authorizer/server/memorystore"
|
||||
"github.com/authorizerdev/authorizer/server/refs"
|
||||
log "github.com/sirupsen/logrus"
|
||||
)
|
||||
@@ -52,6 +53,22 @@ func RegisterEvent(ctx context.Context, eventName string, authRecipe string, use
|
||||
return err
|
||||
}
|
||||
|
||||
// dont trigger webhook call in case of test
|
||||
envKey, err := memorystore.Provider.GetStringStoreEnvVariable(constants.EnvKeyEnv)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
if envKey == constants.TestEnv {
|
||||
db.Provider.AddWebhookLog(ctx, models.WebhookLog{
|
||||
HttpStatus: 200,
|
||||
Request: string(requestBody),
|
||||
Response: string(`{"message": "test"}`),
|
||||
WebhookID: webhook.ID,
|
||||
})
|
||||
|
||||
return nil
|
||||
}
|
||||
|
||||
requestBytesBuffer := bytes.NewBuffer(requestBody)
|
||||
req, err := http.NewRequest("POST", refs.StringValue(webhook.Endpoint), requestBytesBuffer)
|
||||
if err != nil {
|
||||
|
Reference in New Issue
Block a user