Auto-generate startup.json and add database presets
Introduces automatic creation of a self-documenting startup.json file on first startup, with example path configurations for Linux, Windows, and portable setups. Adds preset database configurations to database.xml for easy switching between SQLite and PostgreSQL. Refactors database config classes for XML serialization compatibility and ensures database.xml is never empty. Comprehensive documentation and migration guides included.
This commit is contained in:
+22
-1
@@ -4,15 +4,28 @@
|
||||
|
||||
namespace Jellyfin.Database.Implementations.DbConfiguration;
|
||||
|
||||
using System.Collections.Generic;
|
||||
using System.Xml.Serialization;
|
||||
|
||||
/// <summary>
|
||||
/// Options to configure jellyfins managed database.
|
||||
/// </summary>
|
||||
public class DatabaseConfigurationOptions
|
||||
{
|
||||
/// <summary>
|
||||
/// Initializes a new instance of the <see cref="DatabaseConfigurationOptions"/> class.
|
||||
/// </summary>
|
||||
public DatabaseConfigurationOptions()
|
||||
{
|
||||
// Default to SQLite if not specified
|
||||
DatabaseType = "Jellyfin-SQLite";
|
||||
LockingBehavior = DatabaseLockingBehaviorTypes.NoLock;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Gets or Sets the type of database jellyfin should use.
|
||||
/// </summary>
|
||||
public required string DatabaseType { get; set; }
|
||||
public string? DatabaseType { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets the options required to use a custom database provider.
|
||||
@@ -29,4 +42,12 @@ public class DatabaseConfigurationOptions
|
||||
/// Gets or sets the backup configuration options.
|
||||
/// </summary>
|
||||
public DatabaseBackupOptions? BackupOptions { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets preset configurations for quick switching between database providers.
|
||||
/// These are stored in the configuration file for reference but not used unless DatabaseType is set to match a preset key.
|
||||
/// </summary>
|
||||
[XmlArray("PresetConfigurations")]
|
||||
[XmlArrayItem("PresetConfiguration")]
|
||||
public List<PresetConfigurationItem>? PresetConfigurations { get; set; }
|
||||
}
|
||||
|
||||
+25
@@ -0,0 +1,25 @@
|
||||
// <copyright file="PresetConfigurationItem.cs" company="PlaceholderCompany">
|
||||
// Copyright (c) PlaceholderCompany. All rights reserved.
|
||||
// </copyright>
|
||||
|
||||
namespace Jellyfin.Database.Implementations.DbConfiguration;
|
||||
|
||||
using System.Xml.Serialization;
|
||||
|
||||
/// <summary>
|
||||
/// Represents a key-value pair for XML serialization of preset configurations.
|
||||
/// </summary>
|
||||
public class PresetConfigurationItem
|
||||
{
|
||||
/// <summary>
|
||||
/// Gets or sets the key (name) of the preset.
|
||||
/// </summary>
|
||||
[XmlElement("key")]
|
||||
public string? Key { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets the preset configuration value.
|
||||
/// </summary>
|
||||
[XmlElement("value")]
|
||||
public PresetDatabaseConfiguration? Value { get; set; }
|
||||
}
|
||||
+31
@@ -0,0 +1,31 @@
|
||||
// <copyright file="PresetDatabaseConfiguration.cs" company="PlaceholderCompany">
|
||||
// Copyright (c) PlaceholderCompany. All rights reserved.
|
||||
// </copyright>
|
||||
|
||||
namespace Jellyfin.Database.Implementations.DbConfiguration;
|
||||
|
||||
/// <summary>
|
||||
/// Represents a preset database configuration that can be quickly activated.
|
||||
/// </summary>
|
||||
public class PresetDatabaseConfiguration
|
||||
{
|
||||
/// <summary>
|
||||
/// Gets or sets the database type for this preset.
|
||||
/// </summary>
|
||||
public string? DatabaseType { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets the custom provider options for this preset.
|
||||
/// </summary>
|
||||
public CustomDatabaseOptions? CustomProviderOptions { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets the locking behavior for this preset.
|
||||
/// </summary>
|
||||
public DatabaseLockingBehaviorTypes LockingBehavior { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets a description of this preset.
|
||||
/// </summary>
|
||||
public string? Description { get; set; }
|
||||
}
|
||||
Reference in New Issue
Block a user