feat(configmanager): add configuration models
This commit is contained in:
@@ -0,0 +1,75 @@
|
|||||||
|
using System.Text.Json.Serialization;
|
||||||
|
|
||||||
|
namespace JdeScoping.ConfigManager.Models;
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Root model for appsettings.json configuration.
|
||||||
|
/// </summary>
|
||||||
|
public class ConfigModel
|
||||||
|
{
|
||||||
|
public DataSyncSection DataSync { get; set; } = new();
|
||||||
|
public DataAccessSection DataAccess { get; set; } = new();
|
||||||
|
public AuthSection Auth { get; set; } = new();
|
||||||
|
public LdapSection Ldap { get; set; } = new();
|
||||||
|
public SearchSection Search { get; set; } = new();
|
||||||
|
public ExcelExportSection ExcelExport { get; set; } = new();
|
||||||
|
public Dictionary<string, string> ConnectionStrings { get; set; } = new();
|
||||||
|
}
|
||||||
|
|
||||||
|
public class DataSyncSection
|
||||||
|
{
|
||||||
|
public TimeSpan CheckInterval { get; set; } = TimeSpan.FromMinutes(1);
|
||||||
|
public int MaxDegreeOfParallelism { get; set; } = 4;
|
||||||
|
public int BatchSize { get; set; } = 50000;
|
||||||
|
public int BulkCopyBatchSize { get; set; } = 5000;
|
||||||
|
public double LookbackMultiplier { get; set; } = 1.5;
|
||||||
|
public int PurgeRetentionDays { get; set; } = 90;
|
||||||
|
public int SyncTimeoutSeconds { get; set; } = 3600;
|
||||||
|
public bool Enabled { get; set; } = true;
|
||||||
|
}
|
||||||
|
|
||||||
|
public class DataAccessSection
|
||||||
|
{
|
||||||
|
public int DefaultTimeoutSeconds { get; set; } = 30;
|
||||||
|
public int LotUsageTimeoutSeconds { get; set; } = 120;
|
||||||
|
public int MisDataTimeoutSeconds { get; set; } = 300;
|
||||||
|
public string ProductionSchema { get; set; } = "prod";
|
||||||
|
public string ArchiveSchema { get; set; } = "archive";
|
||||||
|
public string StageSchema { get; set; } = "stage";
|
||||||
|
public bool EnableDetailedLogging { get; set; } = false;
|
||||||
|
}
|
||||||
|
|
||||||
|
public class AuthSection
|
||||||
|
{
|
||||||
|
public string CookieName { get; set; } = ".JdeScoping.Auth";
|
||||||
|
public int CookieExpirationMinutes { get; set; } = 480;
|
||||||
|
}
|
||||||
|
|
||||||
|
public class LdapSection
|
||||||
|
{
|
||||||
|
public string[] ServerUrls { get; set; } = [];
|
||||||
|
public string GroupDn { get; set; } = string.Empty;
|
||||||
|
public string SearchBase { get; set; } = string.Empty;
|
||||||
|
public int ConnectionTimeoutSeconds { get; set; } = 30;
|
||||||
|
public bool UseFakeAuth { get; set; } = false;
|
||||||
|
public string[] AdminBypassUsers { get; set; } = [];
|
||||||
|
}
|
||||||
|
|
||||||
|
public class SearchSection
|
||||||
|
{
|
||||||
|
public int MaxResultRows { get; set; } = 100000;
|
||||||
|
public int TimeoutSeconds { get; set; } = 300;
|
||||||
|
public int MaxConcurrentSearches { get; set; } = 5;
|
||||||
|
}
|
||||||
|
|
||||||
|
public class ExcelExportSection
|
||||||
|
{
|
||||||
|
public string CriteriaSheetPassword { get; set; } = string.Empty;
|
||||||
|
public string DataSheetPassword { get; set; } = string.Empty;
|
||||||
|
public int MaxRowsPerSheet { get; set; } = 1000000;
|
||||||
|
public string DefaultDateFormat { get; set; } = "yyyy-MM-dd HH:mm:ss";
|
||||||
|
public bool DebugWriteToFile { get; set; } = false;
|
||||||
|
public string DebugOutputDirectory { get; set; } = string.Empty;
|
||||||
|
public string TimezoneId { get; set; } = "America/Chicago";
|
||||||
|
public string TimezoneAbbreviation { get; set; } = "CT";
|
||||||
|
}
|
||||||
@@ -0,0 +1,60 @@
|
|||||||
|
namespace JdeScoping.ConfigManager.Models;
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Root model for pipelines.json configuration.
|
||||||
|
/// </summary>
|
||||||
|
public class PipelinesConfigModel
|
||||||
|
{
|
||||||
|
public PipelineSettings Settings { get; set; } = new();
|
||||||
|
public ScheduleDefaults ScheduleDefaults { get; set; } = new();
|
||||||
|
public Dictionary<string, PipelineModel> Pipelines { get; set; } = new();
|
||||||
|
}
|
||||||
|
|
||||||
|
public class PipelineSettings
|
||||||
|
{
|
||||||
|
public string Timezone { get; set; } = "UTC";
|
||||||
|
}
|
||||||
|
|
||||||
|
public class ScheduleDefaults
|
||||||
|
{
|
||||||
|
public ScheduleModel Mass { get; set; } = new() { Enabled = true, IntervalMinutes = 10080, PrePurge = true, ReIndex = true };
|
||||||
|
public ScheduleModel Daily { get; set; } = new() { Enabled = true, IntervalMinutes = 1440 };
|
||||||
|
public ScheduleModel Hourly { get; set; } = new() { Enabled = true, IntervalMinutes = 60 };
|
||||||
|
}
|
||||||
|
|
||||||
|
public class PipelineModel
|
||||||
|
{
|
||||||
|
public PipelineSource Source { get; set; } = new();
|
||||||
|
public PipelineSchedules Schedules { get; set; } = new();
|
||||||
|
public PipelineDestination Destination { get; set; } = new();
|
||||||
|
public string[]? PostScripts { get; set; }
|
||||||
|
}
|
||||||
|
|
||||||
|
public class PipelineSource
|
||||||
|
{
|
||||||
|
public string Connection { get; set; } = string.Empty;
|
||||||
|
public string Query { get; set; } = string.Empty;
|
||||||
|
public string? MassQuery { get; set; }
|
||||||
|
public Dictionary<string, ParameterDefinition> Parameters { get; set; } = new();
|
||||||
|
}
|
||||||
|
|
||||||
|
public class ParameterDefinition
|
||||||
|
{
|
||||||
|
public string Name { get; set; } = string.Empty;
|
||||||
|
public string? Format { get; set; }
|
||||||
|
public string? Source { get; set; }
|
||||||
|
}
|
||||||
|
|
||||||
|
public class PipelineSchedules
|
||||||
|
{
|
||||||
|
public ScheduleModel? Mass { get; set; }
|
||||||
|
public ScheduleModel? Daily { get; set; }
|
||||||
|
public ScheduleModel? Hourly { get; set; }
|
||||||
|
}
|
||||||
|
|
||||||
|
public class PipelineDestination
|
||||||
|
{
|
||||||
|
public string Table { get; set; } = string.Empty;
|
||||||
|
public string[] MatchColumns { get; set; } = [];
|
||||||
|
public string[] ExcludeFromUpdate { get; set; } = [];
|
||||||
|
}
|
||||||
@@ -0,0 +1,12 @@
|
|||||||
|
namespace JdeScoping.ConfigManager.Models;
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Model for schedule configuration.
|
||||||
|
/// </summary>
|
||||||
|
public class ScheduleModel
|
||||||
|
{
|
||||||
|
public bool Enabled { get; set; } = true;
|
||||||
|
public int IntervalMinutes { get; set; } = 60;
|
||||||
|
public bool PrePurge { get; set; } = false;
|
||||||
|
public bool ReIndex { get; set; } = false;
|
||||||
|
}
|
||||||
Reference in New Issue
Block a user