diff options
| -rw-r--r-- | Emby.Server.Implementations/ApplicationHost.cs | 15 | ||||
| -rw-r--r-- | Jellyfin.Server/Program.cs | 20 | ||||
| -rw-r--r-- | Jellyfin.Server/Properties/launchSettings.json | 10 |
3 files changed, 37 insertions, 8 deletions
diff --git a/Emby.Server.Implementations/ApplicationHost.cs b/Emby.Server.Implementations/ApplicationHost.cs index 4fbc933a8..8e1c9d9db 100644 --- a/Emby.Server.Implementations/ApplicationHost.cs +++ b/Emby.Server.Implementations/ApplicationHost.cs @@ -117,6 +117,11 @@ namespace Emby.Server.Implementations /// </summary> public abstract class ApplicationHost : IServerApplicationHost, IDisposable { + /// <summary> + /// The environment variable prefixes to log at server startup. + /// </summary> + private static readonly string[] RelevantEnvVarPrefixes = { "JELLYFIN_", "DOTNET_", "ASPNETCORE_" }; + private SqliteUserRepository _userRepository; private SqliteDisplayPreferencesRepository _displayPreferencesRepository; @@ -887,18 +892,18 @@ namespace Emby.Server.Implementations .GetCommandLineArgs() .Distinct(); - // Get all 'JELLYFIN_' prefixed environment variables + // Get all relevant environment variables var allEnvVars = Environment.GetEnvironmentVariables(); - var jellyfinEnvVars = new Dictionary<object, object>(); + var relevantEnvVars = new Dictionary<object, object>(); foreach (var key in allEnvVars.Keys) { - if (key.ToString().StartsWith("JELLYFIN_", StringComparison.OrdinalIgnoreCase)) + if (RelevantEnvVarPrefixes.Any(prefix => key.ToString().StartsWith(prefix, StringComparison.OrdinalIgnoreCase))) { - jellyfinEnvVars.Add(key, allEnvVars[key]); + relevantEnvVars.Add(key, allEnvVars[key]); } } - logger.LogInformation("Environment Variables: {EnvVars}", jellyfinEnvVars); + logger.LogInformation("Environment Variables: {EnvVars}", relevantEnvVars); logger.LogInformation("Arguments: {Args}", commandLineArgs); logger.LogInformation("Operating system: {OS}", OperatingSystem.Name); logger.LogInformation("Architecture: {Architecture}", RuntimeInformation.OSArchitecture); diff --git a/Jellyfin.Server/Program.cs b/Jellyfin.Server/Program.cs index 5766a9dc3..94a4164ad 100644 --- a/Jellyfin.Server/Program.cs +++ b/Jellyfin.Server/Program.cs @@ -21,9 +21,11 @@ using MediaBrowser.Controller.Drawing; using MediaBrowser.Controller.Extensions; using MediaBrowser.WebDashboard.Api; using Microsoft.AspNetCore.Hosting; +using Microsoft.AspNetCore.Server.Kestrel.Core; using Microsoft.Extensions.Configuration; using Microsoft.Extensions.DependencyInjection; using Microsoft.Extensions.DependencyInjection.Extensions; +using Microsoft.Extensions.Hosting; using Microsoft.Extensions.Logging; using Microsoft.Extensions.Logging.Abstractions; using Serilog; @@ -258,7 +260,7 @@ namespace Jellyfin.Server IApplicationPaths appPaths) { return new WebHostBuilder() - .UseKestrel(options => + .UseKestrel((builderContext, options) => { var addresses = appHost.ServerConfigurationManager .Configuration @@ -280,6 +282,14 @@ namespace Jellyfin.Server appHost.HttpsPort, listenOptions => listenOptions.UseHttps(appHost.Certificate)); } + else if (builderContext.HostingEnvironment.IsDevelopment()) + { + options.Listen(address, appHost.HttpsPort, listenOptions => + { + listenOptions.UseHttps(); + listenOptions.Protocols = HttpProtocols.Http1AndHttp2; + }); + } } } else @@ -293,6 +303,14 @@ namespace Jellyfin.Server appHost.HttpsPort, listenOptions => listenOptions.UseHttps(appHost.Certificate)); } + else if (builderContext.HostingEnvironment.IsDevelopment()) + { + options.ListenAnyIP(appHost.HttpsPort, listenOptions => + { + listenOptions.UseHttps(); + listenOptions.Protocols = HttpProtocols.Http1AndHttp2; + }); + } } }) .ConfigureAppConfiguration(config => config.ConfigureAppConfiguration(commandLineOpts, appPaths, startupConfig)) diff --git a/Jellyfin.Server/Properties/launchSettings.json b/Jellyfin.Server/Properties/launchSettings.json index 53d9fe165..898819f5f 100644 --- a/Jellyfin.Server/Properties/launchSettings.json +++ b/Jellyfin.Server/Properties/launchSettings.json @@ -1,11 +1,17 @@ { "profiles": { "Jellyfin.Server": { - "commandName": "Project" + "commandName": "Project", + "environmentVariables": { + "ASPNETCORE_ENVIRONMENT": "Development" + } }, "Jellyfin.Server (nowebclient)": { "commandName": "Project", - "commandLineArgs": "--nowebclient" + "commandLineArgs": "--nowebclient", + "environmentVariables": { + "ASPNETCORE_ENVIRONMENT": "Development" + } } } } |
