1b7bb26def
Simplify SecureStore by removing MasterKeyEnvVar and password-based methods, leaving only key-file authentication for better security practices.
280 lines
8.6 KiB
C#
280 lines
8.6 KiB
C#
using System.Text.Json.Serialization;
|
|
|
|
namespace JdeScoping.ConfigManager.Models;
|
|
|
|
/// <summary>
|
|
/// Root model for appsettings.json configuration.
|
|
/// </summary>
|
|
public class ConfigModel
|
|
{
|
|
/// <summary>
|
|
/// Gets or sets the data synchronization configuration.
|
|
/// </summary>
|
|
public DataSyncSection DataSync { get; set; } = new();
|
|
|
|
/// <summary>
|
|
/// Gets or sets the data access configuration.
|
|
/// </summary>
|
|
public DataAccessSection DataAccess { get; set; } = new();
|
|
|
|
/// <summary>
|
|
/// Gets or sets the authentication configuration.
|
|
/// </summary>
|
|
public AuthSection Auth { get; set; } = new();
|
|
|
|
/// <summary>
|
|
/// Gets or sets the LDAP directory configuration.
|
|
/// </summary>
|
|
public LdapSection Ldap { get; set; } = new();
|
|
|
|
/// <summary>
|
|
/// Gets or sets the search processing configuration.
|
|
/// </summary>
|
|
public SearchSection Search { get; set; } = new();
|
|
|
|
/// <summary>
|
|
/// Gets or sets the Excel export configuration.
|
|
/// </summary>
|
|
public ExcelExportSection ExcelExport { get; set; } = new();
|
|
|
|
/// <summary>
|
|
/// Gets or sets the connection strings for external data sources.
|
|
/// </summary>
|
|
public ConnectionStringsSection ConnectionStrings { get; set; } = new();
|
|
|
|
/// <summary>
|
|
/// Gets or sets the secure store configuration.
|
|
/// </summary>
|
|
public SecureStoreSection SecureStore { get; set; } = new();
|
|
|
|
/// <summary>
|
|
/// Gets or sets the pipelines configuration.
|
|
/// </summary>
|
|
public PipelinesSection Pipelines { get; set; } = new();
|
|
}
|
|
|
|
public class DataSyncSection
|
|
{
|
|
/// <summary>
|
|
/// Gets or sets the interval between successive data sync checks.
|
|
/// </summary>
|
|
public TimeSpan CheckInterval { get; set; } = TimeSpan.FromMinutes(1);
|
|
|
|
/// <summary>
|
|
/// Gets or sets the maximum degree of parallelism for sync operations.
|
|
/// </summary>
|
|
public int MaxDegreeOfParallelism { get; set; } = 4;
|
|
|
|
/// <summary>
|
|
/// Gets or sets the batch size for data sync operations.
|
|
/// </summary>
|
|
public int BatchSize { get; set; } = 50000;
|
|
|
|
/// <summary>
|
|
/// Gets or sets the batch size for bulk copy operations.
|
|
/// </summary>
|
|
public int BulkCopyBatchSize { get; set; } = 5000;
|
|
|
|
/// <summary>
|
|
/// Gets or sets the lookback multiplier for data sync delta calculations.
|
|
/// </summary>
|
|
public double LookbackMultiplier { get; set; } = 1.5;
|
|
|
|
/// <summary>
|
|
/// Gets or sets the number of days to retain synced data before purging.
|
|
/// </summary>
|
|
public int PurgeRetentionDays { get; set; } = 90;
|
|
|
|
/// <summary>
|
|
/// Gets or sets the timeout in seconds for sync operations.
|
|
/// </summary>
|
|
public int SyncTimeoutSeconds { get; set; } = 3600;
|
|
|
|
/// <summary>
|
|
/// Gets or sets a value indicating whether data synchronization is enabled.
|
|
/// </summary>
|
|
public bool Enabled { get; set; } = true;
|
|
}
|
|
|
|
public class DataAccessSection
|
|
{
|
|
/// <summary>
|
|
/// Gets or sets the default timeout in seconds for database queries.
|
|
/// </summary>
|
|
public int DefaultTimeoutSeconds { get; set; } = 30;
|
|
|
|
/// <summary>
|
|
/// Gets or sets the timeout in seconds for lot usage queries.
|
|
/// </summary>
|
|
public int LotUsageTimeoutSeconds { get; set; } = 120;
|
|
|
|
/// <summary>
|
|
/// Gets or sets the timeout in seconds for MIS data queries.
|
|
/// </summary>
|
|
public int MisDataTimeoutSeconds { get; set; } = 300;
|
|
|
|
/// <summary>
|
|
/// Gets or sets the schema name for production data.
|
|
/// </summary>
|
|
public string ProductionSchema { get; set; } = "prod";
|
|
|
|
/// <summary>
|
|
/// Gets or sets the schema name for archive data.
|
|
/// </summary>
|
|
public string ArchiveSchema { get; set; } = "archive";
|
|
|
|
/// <summary>
|
|
/// Gets or sets the schema name for staging data.
|
|
/// </summary>
|
|
public string StageSchema { get; set; } = "stage";
|
|
|
|
/// <summary>
|
|
/// Gets or sets a value indicating whether detailed query logging is enabled.
|
|
/// </summary>
|
|
public bool EnableDetailedLogging { get; set; } = false;
|
|
}
|
|
|
|
public class AuthSection
|
|
{
|
|
/// <summary>
|
|
/// Gets or sets the name of the authentication cookie.
|
|
/// </summary>
|
|
public string CookieName { get; set; } = ".JdeScoping.Auth";
|
|
|
|
/// <summary>
|
|
/// Gets or sets the cookie expiration time in minutes.
|
|
/// </summary>
|
|
public int CookieExpirationMinutes { get; set; } = 480;
|
|
}
|
|
|
|
public class LdapSection
|
|
{
|
|
/// <summary>
|
|
/// Gets or sets the LDAP server URLs to connect to.
|
|
/// </summary>
|
|
public string[] ServerUrls { get; set; } = [];
|
|
|
|
/// <summary>
|
|
/// Gets or sets the distinguished name of the LDAP group for authorization.
|
|
/// </summary>
|
|
public string GroupDn { get; set; } = string.Empty;
|
|
|
|
/// <summary>
|
|
/// Gets or sets the base distinguished name for LDAP searches.
|
|
/// </summary>
|
|
public string SearchBase { get; set; } = string.Empty;
|
|
|
|
/// <summary>
|
|
/// Gets or sets the connection timeout in seconds for LDAP operations.
|
|
/// </summary>
|
|
public int ConnectionTimeoutSeconds { get; set; } = 30;
|
|
|
|
/// <summary>
|
|
/// Gets or sets a value indicating whether to use fake authentication instead of LDAP.
|
|
/// </summary>
|
|
public bool UseFakeAuth { get; set; } = false;
|
|
|
|
/// <summary>
|
|
/// Gets or sets an array of user names that bypass group membership validation.
|
|
/// </summary>
|
|
public string[] AdminBypassUsers { get; set; } = [];
|
|
}
|
|
|
|
public class SearchSection
|
|
{
|
|
/// <summary>
|
|
/// Gets or sets the maximum number of result rows returned by a search.
|
|
/// </summary>
|
|
public int MaxResultRows { get; set; } = 100000;
|
|
|
|
/// <summary>
|
|
/// Gets or sets the timeout in seconds for search operations.
|
|
/// </summary>
|
|
public int TimeoutSeconds { get; set; } = 300;
|
|
|
|
/// <summary>
|
|
/// Gets or sets the maximum number of concurrent search operations allowed.
|
|
/// </summary>
|
|
public int MaxConcurrentSearches { get; set; } = 5;
|
|
}
|
|
|
|
public class ExcelExportSection
|
|
{
|
|
/// <summary>
|
|
/// Gets or sets the password for protecting the criteria worksheet.
|
|
/// </summary>
|
|
public string CriteriaSheetPassword { get; set; } = string.Empty;
|
|
|
|
/// <summary>
|
|
/// Gets or sets the password for protecting the data worksheet.
|
|
/// </summary>
|
|
public string DataSheetPassword { get; set; } = string.Empty;
|
|
|
|
/// <summary>
|
|
/// Gets or sets the maximum number of rows per Excel worksheet.
|
|
/// </summary>
|
|
public int MaxRowsPerSheet { get; set; } = 1000000;
|
|
|
|
/// <summary>
|
|
/// Gets or sets the default date format for Excel exports.
|
|
/// </summary>
|
|
public string DefaultDateFormat { get; set; } = "yyyy-MM-dd HH:mm:ss";
|
|
|
|
/// <summary>
|
|
/// Gets or sets a value indicating whether to write debug output to files.
|
|
/// </summary>
|
|
public bool DebugWriteToFile { get; set; } = false;
|
|
|
|
/// <summary>
|
|
/// Gets or sets the directory path for debug output files.
|
|
/// </summary>
|
|
public string DebugOutputDirectory { get; set; } = string.Empty;
|
|
|
|
/// <summary>
|
|
/// Gets or sets the time zone identifier for date/time conversions.
|
|
/// </summary>
|
|
public string TimezoneId { get; set; } = "America/Chicago";
|
|
|
|
/// <summary>
|
|
/// Gets or sets the time zone abbreviation for display purposes.
|
|
/// </summary>
|
|
public string TimezoneAbbreviation { get; set; } = "CT";
|
|
}
|
|
|
|
/// <summary>
|
|
/// Configuration section for the secure store.
|
|
/// </summary>
|
|
public class SecureStoreSection
|
|
{
|
|
/// <summary>
|
|
/// Gets or sets the path to the secure store file.
|
|
/// </summary>
|
|
public string StorePath { get; set; } = "data/secrets.json";
|
|
|
|
/// <summary>
|
|
/// Gets or sets the path to the key file for encryption/decryption.
|
|
/// </summary>
|
|
public string KeyFilePath { get; set; } = "data/secrets.key";
|
|
|
|
/// <summary>
|
|
/// Gets or sets a value indicating whether to auto-create the store if it doesn't exist.
|
|
/// </summary>
|
|
public bool AutoCreateStore { get; set; } = true;
|
|
|
|
/// <summary>
|
|
/// Gets or sets the list of required secret keys that must exist in the store.
|
|
/// </summary>
|
|
public List<string> RequiredKeys { get; set; } = [];
|
|
}
|
|
|
|
/// <summary>
|
|
/// Configuration section for pipelines.
|
|
/// </summary>
|
|
public class PipelinesSection
|
|
{
|
|
/// <summary>
|
|
/// Gets or sets the path to the pipelines configuration file.
|
|
/// </summary>
|
|
public string ConfigPath { get; set; } = "Pipelines/pipelines.json";
|
|
}
|