Add file-based startup config & temp dir option

Added support for configuring all major Jellyfin paths (data, config, cache, log, temp, web) via a `startup.json` file, with priority after CLI and environment variables. Introduced a new `TempDir` option, configurable through CLI, env var, or config file, with backward-compatible defaults. Refactored path resolution logic to integrate file-based config and ensure directory creation. Updated constructors and CLI options to support temp directory. Improved EF Core migration error handling and logging. Added comprehensive documentation and example config files. All changes are backward compatible.
This commit is contained in:
2026-02-25 15:18:23 -05:00
parent dad5cbadf5
commit c38adfc0f7
15 changed files with 1764 additions and 22 deletions
@@ -25,18 +25,21 @@ namespace Emby.Server.Implementations.AppBase
/// <param name="configurationDirectoryPath">The configuration directory path.</param>
/// <param name="cacheDirectoryPath">The cache directory path.</param>
/// <param name="webDirectoryPath">The web directory path.</param>
/// <param name="tempDirectoryPath">The temp directory path.</param>
protected BaseApplicationPaths(
string programDataPath,
string logDirectoryPath,
string configurationDirectoryPath,
string cacheDirectoryPath,
string webDirectoryPath)
string webDirectoryPath,
string? tempDirectoryPath = null)
{
ProgramDataPath = programDataPath;
LogDirectoryPath = logDirectoryPath;
ConfigurationDirectoryPath = configurationDirectoryPath;
CachePath = cacheDirectoryPath;
WebPath = webDirectoryPath;
TempDirectory = tempDirectoryPath ?? Path.Join(Path.GetTempPath(), "jellyfin");
DataPath = Directory.CreateDirectory(Path.Combine(ProgramDataPath, "data")).FullName;
}
@@ -77,7 +80,7 @@ namespace Emby.Server.Implementations.AppBase
public string CachePath { get; set; }
/// <inheritdoc/>
public string TempDirectory => Path.Join(Path.GetTempPath(), "jellyfin");
public string TempDirectory { get; }
/// <inheritdoc />
public string TrickplayPath => Path.Combine(DataPath, "trickplay");
@@ -21,18 +21,21 @@ namespace Emby.Server.Implementations
/// <param name="configurationDirectoryPath">The path for Jellyfin's configuration directory.</param>
/// <param name="cacheDirectoryPath">The path for Jellyfin's cache directory.</param>
/// <param name="webDirectoryPath">The path for Jellyfin's web UI.</param>
/// <param name="tempDirectoryPath">The path for Jellyfin's temp files.</param>
public ServerApplicationPaths(
string programDataPath,
string logDirectoryPath,
string configurationDirectoryPath,
string cacheDirectoryPath,
string webDirectoryPath)
string webDirectoryPath,
string? tempDirectoryPath = null)
: base(
programDataPath,
logDirectoryPath,
configurationDirectoryPath,
cacheDirectoryPath,
webDirectoryPath)
webDirectoryPath,
tempDirectoryPath)
{
// ProgramDataPath cannot change when the server is running, so cache these to avoid allocations.
RootFolderPath = Path.Join(ProgramDataPath, "root");