| | | 1 | | using ArturRios.Util.WebApi.Middleware; |
| | | 2 | | |
| | | 3 | | namespace ArturRios.Util.WebApi.Configuration; |
| | | 4 | | |
| | | 5 | | /// <summary>Options that tune the standard sequence <see cref="WebApiStartup"/> builds the application with.</summary> |
| | | 6 | | public class WebApiStartupOptions |
| | | 7 | | { |
| | | 8 | | /// <summary>Whether and how Swagger is generated and served.</summary> |
| | 41 | 9 | | public WebApiSwaggerOptions Swagger { get; } = new(); |
| | | 10 | | |
| | | 11 | | /// <summary>Whether <see cref="TraceActivityMiddleware"/> logs the client's IP address and tags it on the request's |
| | | 12 | | /// activity. Both default to <see langword="true"/>. A <c>Configure<TraceActivityOptions></c> call in |
| | | 13 | | /// <c>ConfigureServices</c> runs after these values are applied, so it wins.</summary> |
| | 54 | 14 | | public TraceActivityOptions TraceActivity { get; } = new(); |
| | | 15 | | |
| | | 16 | | /// <summary>Whether invalid model state is answered with a failed <c>DataOutput</c> envelope (see |
| | | 17 | | /// <see cref="ServiceCollectionExtensions.AddInvalidModelStateEnvelope"/>). Defaults to <see langword="true"/>.</su |
| | 41 | 18 | | public bool UseInvalidModelStateEnvelope { get; set; } = true; |
| | | 19 | | |
| | | 20 | | /// <summary>The name of the CORS policy to apply, registered in <c>ConfigureServices</c> with <c>AddCors</c>. |
| | | 21 | | /// Applied before authentication so preflight requests pass. <see langword="null"/> (the default) for no CORS.</sum |
| | 21 | 22 | | public string? CorsPolicy { get; set; } |
| | | 23 | | |
| | | 24 | | /// <summary>Additional <see cref="WebApiMiddleware"/> types, added in order after the standard middlewares and |
| | | 25 | | /// before the endpoints.</summary> |
| | 42 | 26 | | public List<Type> Middlewares { get; } = []; |
| | | 27 | | } |