Files
pgsql-jellyfin/TEMP_DIR_CONFIGURATION_FEATURE.md
T
wjones c38adfc0f7 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.
2026-02-25 15:18:23 -05:00

4.3 KiB

Summary: Path Configuration Enhancement

Changes Made

All Paths Are Now Configurable!

All major Jellyfin paths can be configured via command-line options or environment variables:

Path Type Command Line Environment Variable Default
Program Data -d, --datadir JELLYFIN_DATA_DIR %LocalAppData%/jellyfin
Configuration -c, --configdir JELLYFIN_CONFIG_DIR {datadir}/config or XDG
Cache -C, --cachedir JELLYFIN_CACHE_DIR {datadir}/cache or XDG
Logs -l, --logdir JELLYFIN_LOG_DIR {datadir}/log
Temp -t, --tempdir JELLYFIN_TEMP_DIR {system_temp}/jellyfin
Web Client -w, --webdir JELLYFIN_WEB_DIR wwwroot or jellyfin-web

New Feature: Configurable Temp Directory

Previously: Temp directory was hardcoded to {system_temp}/jellyfin

Now: Fully configurable with:

  • Command-line option: -t, --tempdir <path>
  • Environment variable: JELLYFIN_TEMP_DIR
  • Maintains backward compatibility with sensible default

Files Modified

  1. Jellyfin.Server/StartupOptions.cs

    • Added TempDir property with command-line option -t, --tempdir
  2. Emby.Server.Implementations/AppBase/BaseApplicationPaths.cs

    • Changed TempDirectory from computed property to stored property
    • Added tempDirectoryPath parameter to constructor
  3. Emby.Server.Implementations/ServerApplicationPaths.cs

    • Added tempDirectoryPath parameter to constructor
    • Passes temp directory to base class
  4. Jellyfin.Server/Helpers/StartupHelpers.cs

    • Added logic to resolve temp directory from options/env var/default
    • Creates temp directory during initialization
    • Passes temp directory to ServerApplicationPaths constructor

Usage Examples

Command Line

# Linux
jellyfin --tempdir /var/tmp/jellyfin

# Windows
jellyfin.exe --tempdir "D:\Temp\Jellyfin"

# All paths at once
jellyfin --datadir /var/lib/jellyfin --configdir /etc/jellyfin --cachedir /var/cache/jellyfin --logdir /var/log/jellyfin --tempdir /var/tmp/jellyfin

Environment Variables

# Linux/macOS
export JELLYFIN_TEMP_DIR=/var/tmp/jellyfin

# Windows PowerShell
$env:JELLYFIN_TEMP_DIR="D:\Temp\Jellyfin"

Docker Compose

version: '3.8'
services:
  jellyfin:
    image: jellyfin/jellyfin:latest
    environment:
      - JELLYFIN_TEMP_DIR=/temp
    volumes:
      - /fast-storage/jellyfin/temp:/temp

Benefits

Performance

  • Place temp directory on fast SSD/NVMe for better transcoding performance
  • Separate I/O load across different disks

Storage Management

  • Use different mount points for different types of data
  • Easier disk space quota management
  • Prevent temp files from filling up data partition

Security

  • Follow OS best practices (Linux FHS, Windows Program Data, etc.)
  • Set appropriate permissions per directory type
  • Separate user data from temporary files

Backup & Maintenance

  • Exclude temp directory from backups
  • Easier cleanup of temporary files
  • Better separation of concerns

Containerization

  • Proper volume mapping for ephemeral vs persistent data
  • Follow container best practices
  • Simplified Docker/Kubernetes configurations

Testing

Build successful All paths resolve correctly Backward compatibility maintained (defaults to {system_temp}/jellyfin if not specified) Directories created automatically during startup Proper logging of all paths at startup

Documentation

Created comprehensive documentation in PATH_CONFIGURATION_GUIDE.md covering:

  • All configurable paths
  • Usage examples (CLI, environment variables, systemd, Docker)
  • Priority order (CLI > env var > default)
  • Permission setup
  • Verification steps

Backward Compatibility

Fully backward compatible

  • All existing installations will continue to work without changes
  • Default behavior unchanged
  • New parameters are optional
  • No breaking changes to existing configurations

This complements existing path configurations:

  • Program data path (already configurable)
  • Config directory (already configurable)
  • Cache directory (already configurable)
  • Log directory (already configurable)
  • Web directory (already configurable)

Now all major paths are user-configurable! 🎉