This commit is contained in:
h z
2025-05-04 19:11:12 +01:00
parent 619ddc6ddf
commit a97c71caaf
6 changed files with 32 additions and 16 deletions

View File

@@ -13,12 +13,13 @@ public class WebhookAuthFilter : IEndpointFilter
}
public async ValueTask<object?> InvokeAsync(EndpointFilterInvocationContext context, EndpointFilterDelegate next)
{
var expectedToken = Environment.GetEnvironmentVariable("WebhookAuth__RequiredApiToken");
var allowedOrigin = Environment.GetEnvironmentVariable("WebhookAuth__AllowedOrigin");
var expectedToken = Environment.GetEnvironmentVariable("HCI_WEBHOOK_AUTH_TOKEN");
var allowedOrigin = Environment.GetEnvironmentVariable("HCI_WEBHOOK_AUTH_ALLOW_ORIGIN");
if (string.IsNullOrEmpty(expectedToken) || string.IsNullOrEmpty(allowedOrigin))
{
_logger.LogCritical("Required environment variables 'WebhookAuth__RequiredApiToken' or 'WebhookAuth__AllowedOrigin' are not set.");
_logger.LogCritical("Required environment variables 'HCI_WEBHOOK_AUTH_TOKEN' or 'HCI_WEBHOOK_AUTH_TOKEN' are not set.");
_logger.LogInformation($"token: {expectedToken}, allowedOrigin: {allowedOrigin}");
return Results.StatusCode((int)HttpStatusCode.InternalServerError);
}