using System; using Microsoft.Extensions.Configuration; namespace MediaBrowser.Controller.Extensions { /// /// Configuration extensions for MediaBrowser.Controller. /// public static class ConfigurationExtensions { /// /// The key for a setting that specifies the default redirect path /// to use for requests where the URL base prefix is invalid or missing.. /// public const string DefaultRedirectKey = "DefaultRedirectPath"; /// /// The key for the address override option. /// public const string AddressOverrideKey = "PublishedServerUrl"; /// /// The key for a setting that indicates whether the application should host web client content. /// public const string HostWebClientKey = "hostwebclient"; /// /// The key for the FFmpeg probe size option. /// public const string FfmpegProbeSizeKey = "FFmpeg:probesize"; /// /// The key for the FFmpeg analyze duration option. /// public const string FfmpegAnalyzeDurationKey = "FFmpeg:analyzeduration"; /// /// The key for the FFmpeg path option. /// public const string FfmpegPathKey = "ffmpeg"; /// /// The key for a setting that indicates whether playlists should allow duplicate entries. /// public const string PlaylistsAllowDuplicatesKey = "playlists:allowDuplicates"; /// /// The key for a setting that indicates whether kestrel should bind to a unix socket. /// public const string BindToUnixSocketKey = "kestrel:socket"; /// /// The key for the unix socket path. /// public const string UnixSocketPathKey = "kestrel:socketPath"; /// /// The permissions for the unix socket. /// public const string UnixSocketPermissionsKey = "kestrel:socketPermissions"; /// /// Gets a value indicating whether the application should host static web content from the . /// /// The configuration to retrieve the value from. /// The parsed config value. /// The config value is not a valid bool string. See . public static bool HostWebClient(this IConfiguration configuration) => configuration.GetValue(HostWebClientKey); /// /// Gets the FFmpeg probe size from the . /// /// The configuration to read the setting from. /// The FFmpeg probe size option. public static string GetFFmpegProbeSize(this IConfiguration configuration) => configuration[FfmpegProbeSizeKey]; /// /// Gets the FFmpeg analyze duration from the . /// /// The configuration to read the setting from. /// The FFmpeg analyze duration option. public static string GetFFmpegAnalyzeDuration(this IConfiguration configuration) => configuration[FfmpegAnalyzeDurationKey]; /// /// Gets a value indicating whether playlists should allow duplicate entries from the . /// /// The configuration to read the setting from. /// True if playlists should allow duplicates, otherwise false. public static bool DoPlaylistsAllowDuplicates(this IConfiguration configuration) => configuration.GetValue(PlaylistsAllowDuplicatesKey); /// /// Gets a value indicating whether kestrel should bind to a unix socket from the . /// /// The configuration to read the setting from. /// true if kestrel should bind to a unix socket, otherwise false. public static bool UseUnixSocket(this IConfiguration configuration) => configuration.GetValue(BindToUnixSocketKey); /// /// Gets the path for the unix socket from the . /// /// The configuration to read the setting from. /// The unix socket path. public static string GetUnixSocketPath(this IConfiguration configuration) => configuration[UnixSocketPathKey]; /// /// Gets the permissions for the unix socket from the . /// /// The configuration to read the setting from. /// The unix socket permissions. public static string GetUnixSocketPermissions(this IConfiguration configuration) => configuration[UnixSocketPermissionsKey]; } }