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