diff options
| author | Anthony Lavado <anthony@lavado.ca> | 2020-08-13 13:02:02 -0400 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2020-08-13 13:02:02 -0400 |
| commit | dbc1435a9e6567eafd3d499a6b61c95e85d2c85d (patch) | |
| tree | 65eed7c451d71d002a749ec1601ae0cff154f143 /Jellyfin.Server/Program.cs | |
| parent | 5480674c4fcf279bab640f24131d188a6a089eb4 (diff) | |
| parent | 6c92154a9bc78deeafa313c96c1fe474a5976776 (diff) | |
Merge pull request #3671 from Bond-009/unixsocket
Make UNIX socket configurable
Diffstat (limited to 'Jellyfin.Server/Program.cs')
| -rw-r--r-- | Jellyfin.Server/Program.cs | 21 |
1 files changed, 17 insertions, 4 deletions
diff --git a/Jellyfin.Server/Program.cs b/Jellyfin.Server/Program.cs index 9fd706d36..f6ac4e2a3 100644 --- a/Jellyfin.Server/Program.cs +++ b/Jellyfin.Server/Program.cs @@ -344,11 +344,24 @@ namespace Jellyfin.Server } } - // Bind to unix socket (only on OSX and Linux) - if (!RuntimeInformation.IsOSPlatform(OSPlatform.Windows)) + // Bind to unix socket (only on macOS and Linux) + if (startupConfig.UseUnixSocket() && !RuntimeInformation.IsOSPlatform(OSPlatform.Windows)) { - // TODO: allow configuration of socket path - var socketPath = $"{appPaths.DataPath}/socket.sock"; + var socketPath = startupConfig.GetUnixSocketPath(); + if (string.IsNullOrEmpty(socketPath)) + { + var xdgRuntimeDir = Environment.GetEnvironmentVariable("XDG_RUNTIME_DIR"); + if (xdgRuntimeDir == null) + { + // Fall back to config dir + socketPath = Path.Join(appPaths.ConfigurationDirectoryPath, "socket.sock"); + } + else + { + socketPath = Path.Join(xdgRuntimeDir, "jellyfin-socket"); + } + } + // Workaround for https://github.com/aspnet/AspNetCore/issues/14134 if (File.Exists(socketPath)) { |
