| | | 1 | | using Microsoft.AspNetCore.Server.Kestrel.Core; |
| | | 2 | | using Microsoft.AspNetCore.Server.Kestrel.Https; |
| | | 3 | | using Microsoft.AspNetCore.Server.Kestrel.Transport.NamedPipes; |
| | | 4 | | using Kestrun.Health; |
| | | 5 | | namespace Kestrun.Hosting.Options; |
| | | 6 | | |
| | | 7 | | /// <summary> |
| | | 8 | | /// Simple options class for configuring Kestrel server settings. |
| | | 9 | | /// </summary> |
| | | 10 | | /// <remarks> |
| | | 11 | | /// This class provides a strongly-typed alternative to using a hashtable for Kestrel server options. |
| | | 12 | | /// </remarks> |
| | | 13 | | public class KestrunOptions |
| | | 14 | | { |
| | | 15 | | /// <summary> |
| | | 16 | | /// Gets or sets the Kestrel server options. |
| | | 17 | | /// </summary> |
| | 714 | 18 | | public KestrelServerOptions ServerOptions { get; set; } |
| | | 19 | | |
| | | 20 | | /// <summary>Provides access to request limit options. Use a hashtable or a KestrelServerLimits instance.</summary> |
| | 2 | 21 | | public KestrelServerLimits ServerLimits => ServerOptions.Limits; |
| | | 22 | | |
| | | 23 | | /// <summary>Application name (optional, for diagnostics).</summary> |
| | 331 | 24 | | public string? ApplicationName { get; set; } |
| | | 25 | | |
| | | 26 | | /// <summary> |
| | | 27 | | /// Gets or sets the maximum number of runspaces to use for script execution. |
| | | 28 | | /// </summary> |
| | 60 | 29 | | public int? MaxRunspaces { get; set; } |
| | | 30 | | |
| | | 31 | | /// <summary> |
| | | 32 | | /// Gets or sets the minimum number of runspaces to use for script execution. |
| | | 33 | | /// Defaults to 1. |
| | | 34 | | /// </summary> |
| | 717 | 35 | | public int MinRunspaces { get; set; } |
| | | 36 | | |
| | | 37 | | /// <summary> |
| | | 38 | | /// Gets or sets the maximum number of runspaces to use for the scheduler service. |
| | | 39 | | /// Defaults to 8. |
| | | 40 | | /// </summary> |
| | 663 | 41 | | public int MaxSchedulerRunspaces { get; set; } |
| | | 42 | | |
| | | 43 | | /// <summary> |
| | | 44 | | /// Gets or sets the health endpoint configuration. |
| | | 45 | | /// </summary> |
| | 1315 | 46 | | public HealthEndpointOptions Health { get; set; } = new(); |
| | | 47 | | |
| | | 48 | | /// <summary> |
| | | 49 | | /// List of configured listeners for the Kestrel server. |
| | | 50 | | /// Each listener can be configured with its own IP address, port, protocols, and other options. |
| | | 51 | | /// </summary> |
| | 115 | 52 | | public List<ListenerOptions> Listeners { get; } |
| | | 53 | | |
| | | 54 | | /// <summary> |
| | | 55 | | /// Gets the HTTPS connection adapter options. |
| | | 56 | | /// </summary> |
| | 57 | 57 | | public HttpsConnectionAdapterOptions? HttpsConnectionAdapter { get; set; } |
| | | 58 | | |
| | | 59 | | /// <summary> |
| | | 60 | | /// Optional path to a Unix domain socket for Kestrel to listen on. |
| | | 61 | | /// </summary> |
| | 61 | 62 | | public List<string> ListenUnixSockets { get; } |
| | | 63 | | |
| | | 64 | | /// <summary> |
| | | 65 | | /// Optional name of a Named Pipe for Kestrel to listen on. |
| | | 66 | | /// </summary> |
| | 61 | 67 | | public List<string> NamedPipeNames { get; } |
| | | 68 | | |
| | | 69 | | /// <summary> |
| | | 70 | | /// Gets or sets the Named Pipe transport options. |
| | | 71 | | /// </summary> |
| | 59 | 72 | | public NamedPipeTransportOptions? NamedPipeOptions { get; set; } |
| | | 73 | | |
| | | 74 | | /// <summary> |
| | | 75 | | /// Initializes a new instance of the <see cref="KestrunOptions"/> class with default values. |
| | | 76 | | /// </summary> |
| | 656 | 77 | | public KestrunOptions() |
| | | 78 | | { |
| | | 79 | | // Set default values if needed |
| | 656 | 80 | | MinRunspaces = 1; // Default to 1 runspace |
| | 656 | 81 | | Listeners = []; |
| | 656 | 82 | | ServerOptions = new KestrelServerOptions(); |
| | 656 | 83 | | MaxSchedulerRunspaces = 8; // Default max scheduler runspaces |
| | 656 | 84 | | ListenUnixSockets = []; |
| | 656 | 85 | | NamedPipeNames = []; |
| | 656 | 86 | | Health = new HealthEndpointOptions(); |
| | 656 | 87 | | } |
| | | 88 | | } |