Make UNIX socket configurable

This commit is contained in:
Bond_009
2020-07-23 13:18:47 +02:00
parent 9ffe74d979
commit cbe47325b3
3 changed files with 45 additions and 6 deletions

View File

@@ -33,6 +33,16 @@ namespace MediaBrowser.Controller.Extensions
/// </summary>
public const string PlaylistsAllowDuplicatesKey = "playlists:allowDuplicates";
/// <summary>
/// The key for a setting that indicates whether kestrel should bind to a unix socket.
/// </summary>
public const string BindToUnixSocketKey = "kerstrel:socket";
/// <summary>
/// The key for the unix socket path.
/// </summary>
public const string UnixSocketPathKey = "kerstrel:socketPath";
/// <summary>
/// Gets a value indicating whether the application should host static web content from the <see cref="IConfiguration"/>.
/// </summary>
@@ -65,5 +75,21 @@ namespace MediaBrowser.Controller.Extensions
/// <returns>True if playlists should allow duplicates, otherwise false.</returns>
public static bool DoPlaylistsAllowDuplicates(this IConfiguration configuration)
=> configuration.GetValue<bool>(PlaylistsAllowDuplicatesKey);
/// <summary>
/// Gets a value indicating whether kestrel should bind to a unix socket from the <see cref="IConfiguration" />.
/// </summary>
/// <param name="configuration">The configuration to read the setting from.</param>
/// <returns><c>true</c> if kestrel should bind to a unix socket, otherwise <c>false</c>.</returns>
public static bool UseUnixSocket(this IConfiguration configuration)
=> configuration.GetValue<bool>(BindToUnixSocketKey);
/// <summary>
/// Gets the path for the unix socket from the <see cref="IConfiguration" />.
/// </summary>
/// <param name="configuration">The configuration to read the setting from.</param>
/// <returns>The unix socket path.</returns>
public static string GetUnixSocketPath(this IConfiguration configuration)
=> configuration[FfmpegAnalyzeDurationKey];
}
}