Pārlūkot izejas kodu

Add socket support

David 5 gadi atpakaļ
vecāks
revīzija
7367e667f7
1 mainītis faili ar 15 papildinājumiem un 0 dzēšanām
  1. 15 0
      Jellyfin.Server/Program.cs

+ 15 - 0
Jellyfin.Server/Program.cs

@@ -343,6 +343,21 @@ namespace Jellyfin.Server
                             }
                         }
                     }
+
+                    // Bind to unix socket (only on OSX and Linux)
+                    if (!RuntimeInformation.IsOSPlatform(OSPlatform.Windows))
+                    {
+                        // TODO: allow configuration of socket path
+                        var socketPath = $"{appPaths.DataPath}/socket.sock";
+                        // Workaround for https://github.com/aspnet/AspNetCore/issues/14134
+                        if (File.Exists(socketPath))
+                        {
+                            File.Delete(socketPath);
+                        }
+
+                        options.ListenUnixSocket(socketPath);
+                        _logger.LogInformation($"Kestrel listening to unix socket {socketPath}");
+                    }
                 })
                 .ConfigureAppConfiguration(config => config.ConfigureAppConfiguration(commandLineOpts, appPaths, startupConfig))
                 .UseSerilog()