aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBond-009 <bond.009@outlook.com>2020-04-05 15:09:27 +0200
committerGitHub <noreply@github.com>2020-04-05 15:09:27 +0200
commit29539174a3de47c151cc7c7fd192100e6fbe48d7 (patch)
tree9649a7161519f137d43424862d2839a7f0748319
parenta05cdf0b05689fd57f89599af7149b9d941aaed7 (diff)
parentbc91445b5dab26713c7b66629518504d5e4b5168 (diff)
Merge pull request #2636 from mark-monteiro/development-https
Use ASP.NET Core HTTPS Development Certificate
-rw-r--r--Emby.Server.Implementations/ApplicationHost.cs15
-rw-r--r--Jellyfin.Server/Program.cs19
-rw-r--r--Jellyfin.Server/Properties/launchSettings.json10
3 files changed, 36 insertions, 8 deletions
diff --git a/Emby.Server.Implementations/ApplicationHost.cs b/Emby.Server.Implementations/ApplicationHost.cs
index c959cc974..49d3b4d6a 100644
--- a/Emby.Server.Implementations/ApplicationHost.cs
+++ b/Emby.Server.Implementations/ApplicationHost.cs
@@ -118,6 +118,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;
@@ -889,18 +894,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 4abdd59aa..e55b0d4ed 100644
--- a/Jellyfin.Server/Program.cs
+++ b/Jellyfin.Server/Program.cs
@@ -25,6 +25,7 @@ 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;
@@ -259,7 +260,7 @@ namespace Jellyfin.Server
IApplicationPaths appPaths)
{
return new WebHostBuilder()
- .UseKestrel(options =>
+ .UseKestrel((builderContext, options) =>
{
var addresses = appHost.ServerConfigurationManager
.Configuration
@@ -282,6 +283,14 @@ namespace Jellyfin.Server
listenOptions.Protocols = HttpProtocols.Http1AndHttp2;
});
}
+ else if (builderContext.HostingEnvironment.IsDevelopment())
+ {
+ options.Listen(address, appHost.HttpsPort, listenOptions =>
+ {
+ listenOptions.UseHttps();
+ listenOptions.Protocols = HttpProtocols.Http1AndHttp2;
+ });
+ }
}
}
else
@@ -297,6 +306,14 @@ namespace Jellyfin.Server
listenOptions.Protocols = HttpProtocols.Http1AndHttp2;
});
}
+ 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"
+ }
}
}
}