feat: add startup config validation and document ConfigManager pipeline editor
Add ConfigurationValidationRunner with IConfigurationValidator interface for validating required settings at startup. Includes SecureStore and LDAP validators. Expand ConfigManager with pipeline editing UI, dialogs, and step editors. Update documentation with config validation guidance.
This commit is contained in:
@@ -51,4 +51,9 @@ public class DataUpdate
|
||||
/// Number of records in update
|
||||
/// </summary>
|
||||
public long NumberRecords { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// JSON string of parameters used during the sync operation (key:value pairs).
|
||||
/// </summary>
|
||||
public string? Parameters { get; set; }
|
||||
}
|
||||
|
||||
@@ -34,7 +34,7 @@ public class SecureStoreOptions
|
||||
public bool AutoCreateStore { get; set; } = true;
|
||||
|
||||
/// <summary>
|
||||
/// Whether to migrate existing secrets (RSA key, Excel passwords) on startup.
|
||||
/// List of secret keys that must exist in the store for the application to start.
|
||||
/// </summary>
|
||||
public bool MigrateExistingSecrets { get; set; } = true;
|
||||
public List<string> RequiredKeys { get; set; } = [];
|
||||
}
|
||||
|
||||
@@ -0,0 +1,45 @@
|
||||
namespace JdeScoping.Core.Validation;
|
||||
|
||||
/// <summary>
|
||||
/// Result of a configuration validation check.
|
||||
/// </summary>
|
||||
public class ConfigurationValidationResult
|
||||
{
|
||||
/// <summary>
|
||||
/// Name of the validator that produced this result.
|
||||
/// </summary>
|
||||
public string ValidatorName { get; }
|
||||
|
||||
/// <summary>
|
||||
/// True if validation passed (no errors).
|
||||
/// </summary>
|
||||
public bool IsValid => Errors.Count == 0;
|
||||
|
||||
/// <summary>
|
||||
/// List of validation errors that prevent startup.
|
||||
/// </summary>
|
||||
public List<string> Errors { get; } = [];
|
||||
|
||||
/// <summary>
|
||||
/// List of validation warnings (non-fatal).
|
||||
/// </summary>
|
||||
public List<string> Warnings { get; } = [];
|
||||
|
||||
/// <summary>
|
||||
/// Creates a new validation result for a named validator.
|
||||
/// </summary>
|
||||
/// <param name="validatorName">Name of the validator.</param>
|
||||
public ConfigurationValidationResult(string validatorName) => ValidatorName = validatorName;
|
||||
|
||||
/// <summary>
|
||||
/// Adds an error message to the result.
|
||||
/// </summary>
|
||||
/// <param name="message">The error message.</param>
|
||||
public void AddError(string message) => Errors.Add(message);
|
||||
|
||||
/// <summary>
|
||||
/// Adds a warning message to the result.
|
||||
/// </summary>
|
||||
/// <param name="message">The warning message.</param>
|
||||
public void AddWarning(string message) => Warnings.Add(message);
|
||||
}
|
||||
@@ -0,0 +1,24 @@
|
||||
namespace JdeScoping.Core.Validation;
|
||||
|
||||
/// <summary>
|
||||
/// Interface for configuration validators that run on application startup.
|
||||
/// </summary>
|
||||
public interface IConfigurationValidator
|
||||
{
|
||||
/// <summary>
|
||||
/// Order in which this validator runs. Lower values run first.
|
||||
/// Convention: 100=SecureStore, 200=LDAP, 300+=future validators.
|
||||
/// </summary>
|
||||
int Order { get; }
|
||||
|
||||
/// <summary>
|
||||
/// Display name for logging purposes.
|
||||
/// </summary>
|
||||
string Name { get; }
|
||||
|
||||
/// <summary>
|
||||
/// Validates the configuration and returns a result with any errors or warnings.
|
||||
/// </summary>
|
||||
/// <returns>Validation result containing errors and warnings.</returns>
|
||||
ConfigurationValidationResult Validate();
|
||||
}
|
||||
Reference in New Issue
Block a user