# Jellyfin Startup Configuration

This directory contains startup configuration templates for Jellyfin Server.

## Configuration Files

- **`startup.default.json`** - Default configuration (Linux paths)
- **`startup.linux.json`** - Linux-specific configuration template
- **`startup.windows.json`** - Windows-specific configuration template

## Usage

### Linux Systems

The default configuration uses Linux paths (`/var/lib/jellyfin`). To customize:

1. Copy `startup.linux.json` to `startup.json` in your Jellyfin installation directory
2. Edit the paths as needed
3. Restart Jellyfin

```bash
cp startup.linux.json /path/to/jellyfin/startup.json
```

### Windows Systems

For Windows, use the Windows-specific configuration:

1. Copy `startup.windows.json` to `startup.json` in your Jellyfin installation directory
2. Edit the paths as needed (default: `C:/ProgramData/jellyfin`)
3. Restart Jellyfin

```powershell
Copy-Item startup.windows.json C:\Path\To\Jellyfin\startup.json
```

## Configuration Priority

Jellyfin resolves paths in this order (highest priority first):

1. **Command-line arguments** (`-d`, `-c`, `-l`, etc.)
2. **Environment variables** (`JELLYFIN_DATA_DIR`, `JELLYFIN_CONFIG_DIR`, etc.)
3. **`startup.json`** file (user's custom configuration)
4. **Built-in defaults** (OS-specific)

## Path Descriptions

| Path | Purpose |
|------|---------|
| `DataDir` | Database files, metadata, and media library information |
| `ConfigDir` | User settings, configuration files, and user-specific data |
| `CacheDir` | Cached images, thumbnails, and temporary processing files |
| `LogDir` | Application log files |
| `TempDir` | Temporary files during transcoding and processing |
| `WebDir` | Web UI assets (jellyfin-web) |

## Platform-Specific Defaults

### Linux (Default)
All paths use `/var/lib/jellyfin` for system-wide installation.

For user-specific installations, consider using:
- Data: `~/.local/share/jellyfin`
- Config: `~/.config/jellyfin`
- Cache: `~/.cache/jellyfin`

### Windows
All paths use `C:/ProgramData/jellyfin` for system-wide installation.

For user-specific installations, paths will default to:
- `%LOCALAPPDATA%\jellyfin`

### macOS
Jellyfin will automatically use appropriate macOS directories:
- Data: `~/Library/Application Support/jellyfin`
- Config: `~/Library/Application Support/jellyfin/config`
- Cache: `~/Library/Caches/jellyfin`

## Example: Custom Configuration

Create `startup.json`:

```json
{
  "Paths": {
    "DataDir": "/mnt/storage/jellyfin/data",
    "ConfigDir": "/etc/jellyfin",
    "CacheDir": "/var/cache/jellyfin",
    "LogDir": "/var/log/jellyfin",
    "TempDir": "/tmp/jellyfin",
    "WebDir": "/usr/share/jellyfin/web"
  }
}
```

## Environment Variables

You can also set paths via environment variables:

```bash
export JELLYFIN_DATA_DIR=/mnt/storage/jellyfin
export JELLYFIN_CONFIG_DIR=/etc/jellyfin
export JELLYFIN_CACHE_DIR=/var/cache/jellyfin
export JELLYFIN_LOG_DIR=/var/log/jellyfin
export JELLYFIN_TEMP_DIR=/tmp/jellyfin
export JELLYFIN_WEB_DIR=/usr/share/jellyfin/web
```

## Troubleshooting

### Permissions

Ensure the Jellyfin user has read/write permissions to all configured paths:

```bash
# Linux
sudo chown -R jellyfin:jellyfin /var/lib/jellyfin
sudo chmod -R 755 /var/lib/jellyfin
```

```powershell
# Windows - Run as Administrator
icacls "C:\ProgramData\jellyfin" /grant "NETWORK SERVICE:(OI)(CI)F" /T
```

### Verify Current Configuration

Check the Jellyfin logs on startup to see which paths are being used. The first few log entries will show the resolved paths.

## More Information

- [Jellyfin Documentation](https://jellyfin.org/docs/)
- [Installation Guide](https://jellyfin.org/docs/general/installation/)
