diff options
| author | Bond_009 <Bond.009@outlook.com> | 2020-07-23 13:18:47 +0200 |
|---|---|---|
| committer | Bond_009 <Bond.009@outlook.com> | 2020-07-23 13:18:47 +0200 |
| commit | cbe47325b328b70e5a49dc231a70d3709f71dbbd (patch) | |
| tree | f07fd1e11340d377b4d9f0cd6a5dec6becca6e9e /Jellyfin.Server/Program.cs | |
| parent | 9ffe74d97914c82c88f1664a991d2cb65f14a827 (diff) | |
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 444a91c02..f3ee339d1 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)) { |
