feat: add rate limiting and startup options validation

This commit is contained in:
xiong
2026-07-26 13:46:17 +08:00
parent f4783c5de3
commit 015c9b5582
9 changed files with 204 additions and 2 deletions

View File

@@ -5,8 +5,16 @@ public sealed class CorsOptions
public const string SectionName = "Cors";
public const string PolicyName = "TikuCors";
[System.ComponentModel.DataAnnotations.Required]
public string[] AllowedOrigins { get; set; } = [];
[System.ComponentModel.DataAnnotations.Required]
[System.ComponentModel.DataAnnotations.MinLength(1)]
public string[] AllowedHeaders { get; set; } = ["Authorization", "Content-Type", "x-tenant-code"];
[System.ComponentModel.DataAnnotations.Required]
[System.ComponentModel.DataAnnotations.MinLength(1)]
public string[] AllowedMethods { get; set; } = ["GET", "POST", "PUT", "PATCH", "DELETE", "OPTIONS"];
public bool AllowCredentials { get; set; }
}